| | |
Problem sending the SOAP request message to weblogic session web service
Please support our RSS, Web Services and SOAP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2009
Posts: 1
Reputation:
Solved Threads: 0
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:
and the error I am getting is:
My Code is:
Though my soap message have the header information, error says it doesnt have. please help me with this.
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:
XML Syntax (Toggle Plain Text)
<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:
RSS, Web Services and SOAP Syntax (Toggle Plain Text)
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:
Java Syntax (Toggle Plain Text)
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", [url]http://www.bea.com/wsdl/wlcp/wlng/session_manager/service));[/url] 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( [url]http://www.bea.com/wsdl/wlcp/wlng/session_manager/service[/url], "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( [url]http://localhost:8001/session_manager/SessionManager);[/url] 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.
Last edited by peter_budo; Jun 5th, 2009 at 8:01 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
![]() |
Similar Threads
- Writing a Python Client to access a Web Service (Python)
- Client Web Service (Python)
- Accessing a Web Service (RSS, Web Services and SOAP)
- Sending XML Message to Web Service (Java)
- Web Service (ASP.NET)
- HTTP Request Message Issue (PHP)
- How to maintain session for Web Services Object? (VB.NET)
Other Threads in the RSS, Web Services and SOAP Forum
- Previous Thread: How do I set soap:header on my server?
- Next Thread: URL-Based API Key Restriction: How does validation works?
| Thread Tools | Search this Thread |
.htaccess 301 accept alltop api authentication binarysecuritytoken blog card city collaboration country credit data development ebay email evernote flash google government highrise htaccess intel internet ip legal live location patent paypal php podcast proxy redirect rss rssfeeds searchmonkey server soap software swappingxmlfromflash swappingxmlnodes url web webservices webservicesecurity wiki wikipedia xml xslt y!os yahoo ydn





