I
IT Drone
I'm trying to consume a Java-based web service, and the RPC style
requires a message that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<ns1:id soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string"
xmlns:ns1="http://wholesaler.packet8.com/security"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">AA11</ns1:id>
<ns2:login soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string"
xmlns:ns2="http://wholesaler.mycompany.com/security"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">Our
Partner</ns2:login>
<ns3
assword
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string"
xmlns:ns3="http://wholesaler.packet8.com/security"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">password</ns3
assword>
</soapenv:Header>
<soapenv:Body>
<ns4:getProductList
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:wholesaler.mycompany.com">
<id xsi:type="xsd:string">AA11</id>
</ns4:getProductList>
</soapenv:Body>
</soapenv:Envelope>
Now the problem is that I can't get .net to do:
<Envelope>
<Header>
<login>name></login>
</Header>
etc.
I only seem to be able to get it to do:
<Envelope>
<Header>
<customHeader>
<login>name></login>
</customHeader>
</Header>
etc.
I suspect that I need to use something in System.Xml.Serialization. I
tried just adding
[SoapAttribute( AttributeName = "login")]
public String partnerlogin;
to the top of my proxy class but that didn't seem to get it in the
right place.
How do I modify the proxy class to add these extra three fields I need
to the generated header, without ending up with a new header inside it?
Thanks,
Your faithful IT Drone
requires a message that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<ns1:id soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string"
xmlns:ns1="http://wholesaler.packet8.com/security"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">AA11</ns1:id>
<ns2:login soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string"
xmlns:ns2="http://wholesaler.mycompany.com/security"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">Our
Partner</ns2:login>
<ns3
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0" xsi:type="soapenc:string"
xmlns:ns3="http://wholesaler.packet8.com/security"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">password</ns3
</soapenv:Header>
<soapenv:Body>
<ns4:getProductList
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:wholesaler.mycompany.com">
<id xsi:type="xsd:string">AA11</id>
</ns4:getProductList>
</soapenv:Body>
</soapenv:Envelope>
Now the problem is that I can't get .net to do:
<Envelope>
<Header>
<login>name></login>
</Header>
etc.
I only seem to be able to get it to do:
<Envelope>
<Header>
<customHeader>
<login>name></login>
</customHeader>
</Header>
etc.
I suspect that I need to use something in System.Xml.Serialization. I
tried just adding
[SoapAttribute( AttributeName = "login")]
public String partnerlogin;
to the top of my proxy class but that didn't seem to get it in the
right place.
How do I modify the proxy class to add these extra three fields I need
to the generated header, without ending up with a new header inside it?
Thanks,
Your faithful IT Drone