I am pretty new to SOAP and i am struggling to create a SOAP POST request to a server . I have the following sample request:-
POST /sso/ArtifactResolver/metaAlias/assert-idp
HTTP/1.1
Host:xxx
Content-Type: text/xml
Content-Length:
SOAPAction:http://....
and here is my SOAP Envevelop
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<samlp:ArtifactResolve
xmlns:samlp="xxxxxxxxxxxxxx"
xmlns="xxxxxxxxxxx"
ID="_6c3a4f8b9c2d"
25 March 2014 Page 30
(APPROVED – Version 1.1)
Version="2.0"
IssueInstant="2012-05-21T00:39:45Z">
<Issuer>https://www.xxxxxxxxxxxxxx</Issuer>
<Artifact>
AAQAABWFTOPhANZhf21nl9DmXsAkiSM0ocx7GdxUfXFttmS954 BP6Vb01I0=
</Artifact>
</samlp:ArtifactResolve>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Below is my java code i am trying to use:-
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage soapMsg = factory.createMessage();
SOAPPart part = soapMsg.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPHeader header = envelope.getHeader();
SOAPBody body = envelope.getBody();
SOAPBodyElement element = body.addBodyElement(envelope.createName("ArtifactResolve", "sampl", "xxxxxxxxxxxx"));
element.addChildElement("Issuer").addTextNode("xxxxxxxxxxx");
element.addChildElement("Artifact").addTextNode("xxxxxxxxxxxx");
element.setAttribute("xmlns", "xxxxxxxxxxxxx");
element.setAttribute("ID", "xxxxxxxxx");
element.setAttribute("Version", "2.0");
element.setAttribute("IssueInstant", "xxxxxxxxxx");
PostMethod post = new PostMethod("PUT Server Url");
// Request content will be retrieved directly from the input stream
post.setRequestEntity(entity);
// consult documentation for your web service
post.setRequestHeader("SOAPAction", "**what to put here????**");
// Get HTTP client
HttpClient httpclient = new HttpClient();
try {
int result = httpclient.executeMethod(post);
System.out.println(post.getResponseBodyAsString());
} finally {
// Release current connection to the connection pool once you are done
post.releaseConnection();
}
Now in the above code where to specify the Server url? Second is how to pass complete soap XML to post request? How to pass the top POST data which is given? What to give for soap action.?
Sorry for this guys buy i am completely new to this so no idea. I tried looking for this over the internet but no help.
Please help me out over here
Thanks ...