I want to connect to a SOAP service.
using wsimport I've generated classes from a remote wsdl
My code:
Lists listsService = new Lists();
ListsSoap lisoap = listsService .getListsSoap();
((BindingProvider) si).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "MY_USER");
((BindingProvider) si).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "“MY_PASS");
((BindingProvider) si).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://<SOME_REMOTE_URL>/Lists.asmx");
GetListCollectionResult coll = si.getListCollection();
I've traced the request xml:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap1="http://schemas.microsoft.com/sharepoint/soap/">
<S:Header/>
<S:Body>
<soap1:GetListCollection/>
</S:Body>
</S:Envelope>
http://schemas.xmlsoap.org/soap/envelope - is wrong!
Returns empty result, both in java and SOAP-UI
the correct URI should be http://www.w3.org/2003/05/soap-envelope
It works in SOAP-UI but i don't know how to set it in java for JAX-WS
I suspect it's related to SOAP version 1 vs 1.2
UPDATE:
Tried to run this:
soapEnv.setAttributeNS("http://schemas.xmlsoap.org/soap/envelope/", "S", "http://www.w3.org/2000/xmlns/");
But the output now is:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" ns0:S="http://www.w3.org/2000/xmlns/">
Almost good but not enoguh