Hi, 

I desperately try to convert a working HttpClient POST method making an
authentication with 'application/soap+xml' as content type into a working
SOAP Request. The 'client' making the authentication is an instance of
org.apache.axis2.transport.SimpleAxis2Server and the link it tries to reach
starts with 'https://'.

The following code works fine:

HttpClient client = new HttpClient();
PostMethod post = new PostMethod(url);
StringRequestEntity entity = new StringRequestEntity(xmlMessage,
"application/soap+xml", "utf-8");
post.setRequestEntity(entity);
client.executeMethod(post);
String response = post.getResponseBodyAsString();

The following does not work:

ServiceClient sender = new ServiceClient();
EndpointReference targetEPR = new EndpointReference(url);
Options options = sender.getOptions();
options.setTo(targetEPR);
options.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP,
false);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);

sender.setOptions(options);
XMLStreamReader reader =
XMLInputFactory.newInstance().createXMLStreamReader(new
StringReader(xmlMess
age));
OMElement element = new StAXOMBuilder(reader).getDocumentElement();

OMElement result = sender.sendReceive(element);
OMElement ele = result.getFirstElement();
OMText binaryNode = (OMText) ele.getFirstOMChild();

What am I doing wrong? Any help would be gratefully appreciated. Thanks a
lot,

chris



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to