I generated Code for the following wsdl [1] which is listed in the microsoft
interop site.
used the following command to codegen with a build I locally created for the
current svn.

sh wsdl2java.sh -uri
http://131.107.72.15/WSAddressingCR_Service_WCF/WSAddressingAugust2004.svc?wsdl-o
~/projects/microsoftInterop/addressing/ -ap -uw -u -p
org.tempuri.submission.echo

try to send a request to CustomBinding_Echo2 in following way

public void testCustomBinding_Echo2() {
       try {
           WSAddressingCRCustomBinding_Echo2Stub stub = new
WSAddressingCRCustomBinding_Echo2Stub(
                   configurationContext,
                   "
http://131.107.72.15/WSAddressingCR_Service_WCF/WSAddressingAugust2004.svc/Soap11/Manual
");
           stub._getServiceClient().getOptions().setProperty(
AddressingConstants.WS_ADDRESSING_VERSION,
                   AddressingConstants.Submission.WSA_NAMESPACE);
           stub._getServiceClient().getOptions().setProperty(
AddressingConstants.INCLUDE_OPTIONAL_HEADERS,true);

          // this is to redirect the message to tcpmon with out changing
the To field
           stub._getServiceClient().getOptions().setProperty(
Constants.Configuration.TRANSPORT_URL,
                   "
http://localhost:8085/WSAddressingCR_Service_WCF/WSAddressingAugust2004.svc/Soap11/Manual
");

           String result = stub.Echo("Test String");
           assertEquals(result,"Test String");
      } catch (AxisFault axisFault) {
           axisFault.printStackTrace();
           fail();
       } catch (java.rmi.RemoteException e) {
           fail();
       }
}

here configuration context is point to defult axis2.xml and repository.

I got the follwing exception
org.apache.axis2.AxisFault: A required message information header, To,
MessageID, or Action, is not present.
   at
org.apache.axis2.addressing.AddressingFaultsHelper.triggerAddressingFault(
AddressingFaultsHelper.java:352)
   at
org.apache.axis2.addressing.AddressingFaultsHelper.triggerMessageAddressingRequiredFault
(AddressingFaultsHelper.java:272)
   at
org.apache.axis2.handlers.addressing.AddressingSubmissionInHandler.checkForMandatoryHeaders
(AddressingSubmissionInHandler.java:53)
   at
org.apache.axis2.handlers.addressing.AddressingInHandler.extractAddressingInformation
(AddressingInHandler.java:185)
   at org.apache.axis2.handlers.addressing.AddressingInHandler.invoke(
AddressingInHandler.java:94)
   at org.apache.axis2.engine.Phase.invoke(Phase.java:288)
   at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:225)
   at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:146)
   at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(
OutInAxisOperation.java:345)
   at org.apache.axis2.description.OutInAxisOperationClient.send(
OutInAxisOperation.java:388)
   at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
OutInAxisOperation.java:202)
   at org.apache.axis2.client.OperationClient.execute(OperationClient.java
:142)
   at
org.tempuri.submission.echo.WSAddressingCRCustomBinding_Echo2Stub.Echo
(WSAddressingCRCustomBinding_Echo2Stub.java:178)
   at
org.tempuri.submission.echo.WSAddressingCRSubmissionTest.testCustomBinding_Echo2
(WSAddressingCRSubmissionTest.java:184)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)

Here is the request and response messages
<?xml version='1.0' encoding='UTF-8'?>
  <soapenv:Envelope xmlns:wsa="
http://schemas.xmlsoap.org/ws/2004/08/addressing"; xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/";>
     <soapenv:Header>
        <wsa:To>
http://131.107.72.15/WSAddressingCR_Service_WCF/WSAddressingAugust2004.svc/Soap11/Manual
</wsa:To>
        <wsa:ReplyTo>
           <wsa:Address>
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
</wsa:Address>
        </wsa:ReplyTo>

<wsa:MessageID>urn:uuid:A26E71AFEBE8477B8D1183128682560</wsa:MessageID>
        <wsa:Action>http://example.org/action/echoIn</wsa:Action>
     </soapenv:Header>
     <soapenv:Body>
        <s1:echoIn xmlns:s1="http://example.org/echo";>Test
String</s1:echoIn>
     </soapenv:Body>
  </soapenv:Envelope>0

response
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"; xmlns:a="
http://schemas.xmlsoap.org/ws/2004/08/addressing";>
  <s:Header>
     <a:Action s:mustUnderstand="1">http://example.org/action/echoOut
</a:Action>
     <a:RelatesTo>urn:uuid:A26E71AFEBE8477B8D1183128682560</a:RelatesTo>
  </s:Header>
  <s:Body>
     <echoOut xmlns="http://example.org/echo";>Test String</echoOut>
  </s:Body></s:Envelope>

A part from CustomBinding_Echo2 and CustomBinding_Echo3 ports in submmision
wsdl all other ports works fine.
(i.e final version wsdl works fine for all casses)

Can someone please explain the reason?

Thanks
Amila.

[1]
http://131.107.72.15/WSAddressingCR%5FService%5FWCF/WSAddressingAugust2004.svc?wsdl
[2]http://131.107.72.15/WSAddressingCR%5FService%5FWCF/ - first page
--
Amila Suriarachchi,
WSO2 Inc.

Reply via email to