Hi all,

I've generated a Stub using Axis2 for given WSDL using WSO2-ESB. So I've to add 
following parameters to header when i call the WS

  1.  Simple Authentication (Username , Password)
  2.  WS-Addressing (true) - WS-A
  3.  WS-Reliable Messaging (true) - WS-RM

To add WS-RM to Header I've used 
ApacheSandesha2<http://axis.apache.org/axis2/java/sandesha/userGuide.html>

My Code Snippet is,



 HttpTransportProperties.Authenticator  basicAuthentication = new 
HttpTransportProperties.Authenticator();



basicAuthentication.setUsername("xxxxxxxx");

basicAuthentication.setPassword("xxxxxxxx");



System.out.println("Basic Authentication have generated");



BankingSaviPaySoapStub bankingSaviPaySoapStub = new BankingSaviPaySoapStub();



/**Setting Web Service Authentication Properties to the Stub*/

bankingSaviPaySoapStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED,
 Boolean.FALSE);

bankingSaviPaySoapStub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
 basicAuthentication);



/**Setting WSA Properties to the Stub*/

bankingSaviPaySoapStub._getServiceClient().getOptions().setProperty(AddressingConstants.WS_ADDRESSING_VERSION,

  AddressingConstants.Submission.WSA_NAMESPACE);

bankingSaviPaySoapStub._getServiceClient().getOptions().setProperty(AddressingConstants.INCLUDE_OPTIONAL_HEADERS,

  Boolean.TRUE);





/**Setting WS-RM Properties to the Stub*/

bankingSaviPaySoapStub._getServiceClient().engageModule("addressing");



System.out.println("engaged addressing module.");

bankingSaviPaySoapStub._getServiceClient().engageModule("sandesha2");



System.out.println("engaged sandesha2 module.");

bankingSaviPaySoapStub._getServiceClient().getOptions().setProperty(SandeshaClientConstants.OFFERED_SEQUENCE_ID,
 SandeshaUtil.getUUID());

bankingSaviPaySoapStub._getServiceClient().getOptions().setProperty(SandeshaClientConstants.RM_SPEC_VERSION,
 Sandesha2Constants.SPEC_VERSIONS.v1_1);

bankingSaviPaySoapStub._getServiceClient().getOptions().setProperty(SandeshaClientConstants.SEQUENCE_KEY,
 SandeshaUtil.getUUID());

bankingSaviPaySoapStub._getServiceClient().getOptions().setTransportInProtocol(Constants.TRANSPORT_HTTP);

bankingSaviPaySoapStub._getServiceClient().getOptions().setProperty(SandeshaClientConstants.AcksTo,
 AddressingConstants.Final.WSA_ANONYMOUS_URL);

I've Printed the ServiceClient Options. All the options are binded like below.

{Sandesha2AcksTo=http://www.w3.org/2005/08/addressing/anonymous<http://www.w3.org/2005/08/addressing/anonymous>,
 WSAddressingVersion=http://schemas.xmlsoap.org/ws/2004/08/addressing, 
includeOptionalHeaders=true, 
_NTLM_DIGEST_BASIC_AUTHENTICATION_=org.apache.axis2.transport.http.HttpTransportProperties$Authenticator@f539f96<mailto:_NTLM_DIGEST_BASIC_AUTHENTICATION_=org.apache.axis2.transport.http.HttpTransportProperties$Authenticator@f539f96>,
 __CHUNKED__=false, 
Sandesha2OfferedSequenceId=urn:uuid:286E463BCCB1EC15301446014283931, 
Sandesha2RMSpecVersion=Spec_2007_02, 
Sandesha2SequenceKey=urn:uuid:286E463BCCB1EC15301446014283932}

When I call the web service method using the above code. I get following Error.

org.apache.axis2.AxisFault: Sandesha2 got an exception when processing an out 
message: org.apache.axiom.soap.SOAPProcessingException: Expecting 
SOAP12HeaderImpl as parent, got class 
org.apache.axiom.om.impl.llom.OMElementImpl at 
org.apache.sandesha2.handlers.SandeshaOutHandler.invoke(SandeshaOutHandler.java:166)

        at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)

        at org.apache.axis2.engine.Phase.invoke(Phase.java:313)

        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)

        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)

        at 
org.apache.axis2.description.OutInAxisOperationClient.sendAsync(OutInAxisOperation.java:312)

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

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

        at 
com.fg.ws.BankingSaviPaySoapStub.startpayAnyone(BankingSaviPayanyone1_0SoapStub.java:413)

        at com.fg.ws.app.App.<init>(App.java:148)

        at com.fg.ws.app.App.main(App.java:156)

Caused by: org.apache.axiom.soap.SOAPProcessingException: Expecting 
SOAP12HeaderImpl as parent, got class 
org.apache.axiom.om.impl.llom.OMElementImpl

we have asked in stackoverflow about this problem and still didn’t get any 
answer.This is the URL to the question i added in stackoverflow.

http://stackoverflow.com/questions/33385506/expecting-soap12headerimpl-as 
-parent-got-class-org-apache-axiom-om-impl-llom-om<http://stackoverflow.com/questions/33385506/expecting-soap12headerimpl-as-parent-got-class-org-apache-axiom-om-impl-llom-om>

is there any solution from experts???

Regards,
Akila Rathnayake

This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this message
immediately if this is an electronic communication.

Thank you.
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to