SOAP клиент
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ArtBoxAuthHeader xmlns="http://ArtNetService.nm/ArtBoxService">
<ID>int</ID>
<Password>string</Password>
</ArtBoxAuthHeader>
</soap:Header>
<soap:Body>
<GetArtDecks xmlns="http://ArtNetService.nm/ArtBoxService"/>
</soap:Body>
</soap:Envelope>
===========================================
вот что пока сделано:
SOAPConnectionFactory fact;
fact = SOAPConnectionFactory.newInstance();
SOAPConnection con = fact.createConnection();
javax.xml.soap.SOAPFactory sf = SOAPFactory.newInstance();
MessageFactory mfact = MessageFactory.newInstance();
SOAPMessage smsg = mfact.createMessage();
//Set the WebService end point URL
URL endpoint = new URL("http://192.168.0.5:8080/ArtBoxService.asmx");
//Send the message
SOAPMessage response = con.call(smsg, endpoint);
response.writeTo(System.out);
//Close the connection
con.close();
===========================================
и при этом в System.out выдает:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope>
<soap:Body>
<soap:Fault>
<soap:Code>
<soap:Value>soap:Receiver</soap:Value>
</soap:Code>
<soap:Reason>
<soap:Text>
The root element for the request could not be determined. When RoutingStyle is set to RequestElement, SoapExtensions configured via an attribute on the method cannot modify the request stream before it is read. The extension must be configured via the SoapExtensionTypes element in web.config or the request must arrive at the server as clear text.
</soap:Text>
</soap:Reason>
</soap:Fault>
</soap:Body>
</soap:Envelope>
===========================================
вместо:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetArtDecksResponse xmlns="http://ArtNetService.nm/ArtBoxService">
<GetArtDecksResult>
<ArtDeck>
<ID>int</ID>
<ArtBoxID>int</ArtBoxID>
<Name>string</Name>
<Description>string</Description>
</ArtDeck>
<ArtDeck>
<ID>int</ID>
<ArtBoxID>int</ArtBoxID>
<Name>string</Name>
<Description>string</Description>
</ArtDeck>
</GetArtDecksResult>
</GetArtDecksResponse>
</soap:Body>
</soap:Envelope>
===========================================
не могу понять как имено формируется xml - сообщение, у smsg - нет ни одного метода типа setHeader(...) , setBody(...) вообщем помогите кто знает, уже 2-ой день гугл напрягаю и пока бестолку..
SOAPPart sp = smsg.getSOAPPart();
sp.setContent(...);
sp.addMimeHeader(...);
заранее фэнкс!