axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <naveen.dutt.v...@accenture.com>
Subject Problem invoking the service method.
Date Fri, 05 Jun 2009 10:13:45 GMT
Hello Tenchnocrats,
 
I am getting the following error while invoking the "getSession" method of sessionmanager
webservice deployed in weblogic OCSG.
I have created a soap message properly but its giving error as "javax.xml.soap.SOAPException:
No Security header in message but required by policy."
 
The SOAP message created is by below code is:
"<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header><ns1:SecurityToken
xmlns:ns1="http://www.bea.com/wsdl/wlcp/wlng/session_manager/service"><username>sdpai</username><password>sdp</password></ns1:SecurityToken></soapenv:Header><soapenv:Body><ns2:getSession
xmlns:ns2="http://www.bea.com/wsdl/wlcp/wlng/session_manager/service"><aName>TextMode</aName></ns2:getSession></soapenv:Body></soapenv:Envelope>"

and the error I am getting is:
 
javax.xml.soap.SOAPException: No Security header in message but required by policy.

at org.apache.axis2.saaj.SOAPConnectionImpl.handleSOAPMessage(SOAPConnectionImpl.java:194)

at org.apache.axis2.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:130)

at test.SOARequest.main(SOARequest.java:101)

Caused by: org.apache.axis2.AxisFault: No Security header in message but required by policy.

at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)

at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)

at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)

at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)

at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)

at org.apache.axis2.saaj.SOAPConnectionImpl.handleSOAPMessage(SOAPConnectionImpl.java:188)

... 2 more

 
My Code is:
SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance();
SOAPConnection connection = sfc.createConnection();
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage sm = mf.createMessage();
SOAPPart soapPart = sm.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
SOAPHeader soapHeader = soapEnvelope.getHeader();
SOAPHeaderElement headerElement = soapHeader
.addHeaderElement(soapEnvelope
.createName("SecurityToken", "ns1",
http://www.bea.com/wsdl/wlcp/wlng/session_manager/service));
QName qn1 = new QName("username");
SOAPElement quotation1 = headerElement.addChildElement(qn1);
quotation1.addTextNode("XXX");
QName qn2 = new QName("password");
SOAPElement quotation2 = headerElement.addChildElement(qn2);
quotation2.addTextNode("XXX");
SOAPBody sb = sm.getSOAPBody();
// sh.detachNode();
QName bodyName = new QName(
http://www.bea.com/wsdl/wlcp/wlng/session_manager/service,
"getSession", "ns2");
SOAPBodyElement bodyElement = sb.addBodyElement(bodyName);
QName qn = new QName("aName");
SOAPElement quotation = bodyElement.addChildElement(qn);
quotation.addTextNode("TextMode");
sm
.setContentDescription("This is the request message for getting session ID");
System.out.println("\n Soap Request:\n");
sm.writeTo(System.out);
System.out.println();
System.out.println("My SOAP Message description is: "
+ sm.getContentDescription());
URL endpoint = new URL(
http://localhost:8001/session_manager/SessionManager);
SOAPMessage response = connection.call(sm, endpoint);
System.out.println(response);
System.out.println(response.getContentDescription());

Though my soap message have the header information, error says it doesnt have. please help
me with this. 






This message is for the designated recipient only and may contain privileged, proprietary,
or otherwise private information.  If you have received it in error, please notify the sender
immediately and delete the original.  Any other use of the email by you is prohibited.

Mime
View raw message