axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Euan Milton <euanmil...@hotmail.co.uk>
Subject JAXWS/Axis2 - problems generating correct structure of SOAP message
Date Tue, 01 Oct 2013 09:48:30 GMT
Hi all,
We have a web application which needs to consume an external web service.
To do this we have generated the set of Java artifacts from the WSDL via Maven using the wsdl2java
goal provided by the cxf-codegen-plugin plugin.  The SEI generated by CXF is then used to
invoke the web service.
The code to integrate with the actual web service is then packaged into a set of JARs and
used inside the front end application which needs to use the web service.
As part of the integration JARs, we have written an integration test which actually invokes
the third party web service and every works as expected and the test passes.
We are having an issue when the web application uses the integration JARs to invoke the web
service. Exactly the same code is being executed by the FE application as is being used in
our working integration test but the SOAP message which is ultimately generated is different
between the two and the message generated by the actual web application is incorrect.
The working SOAP request produced by our integration tests is:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
  <S:Body>
    <ns12:ProcessUIRequest xmlns:ns10="http://zzz/yyyentityview/validation/"
    xmlns:ns11="http://zzz/yyyview/search/list/"
    xmlns:ns12="http://zzz/yyywebservice/v5/types/"
    xmlns:ns2="http://zzz/yyyentityview/app/"
    xmlns:ns3="http://zzz/yyyentityview/client/"
    xmlns:ns4="http://zzz/yyyview/search/postcode/"
    xmlns:ns5="http://zzz/yyyview/app/"
    xmlns:ns6="http://zzz/yyyview/search/app/"
    xmlns:ns7="http://zzz/yyyview/search/bank/"
    xmlns:ns8="http://zzz/yyyview/uw/"
    xmlns:ns9="http://zzz/yyybase/">
      <ns12:ProcessUIRequest CallType="Submit" DisplayError="false"
      IsAnonymous="false" IsCompactRequest="false" IsError="false">
        <ns9:ModelData>
          <ns9:TransactionData ApplicationReference="20000003CR3.00000003"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:type="ns5:QuoteLoadTxnDataVO" />
        </ns9:ModelData>
        <ns9:Activity ActionCode="QuoteLoad" ActionMode="Default"
        ActivityCode="QuoteApplicationFull" ActivityMode="Default"
        ActivityReference="" ActivityStatus="Inital"
        ActivityTransaction="StartNewActivityAndLogOffUser"
        CanProceedWithValidationsOutstanding="true">
          <ns9:BusinessKeys>
            <item>
              <key>
                <string>ADVREF</string>
              </key>
              <value>
                <BusinessKeyVO KeyName="ADVREF" KeyValue="AVAGT01">
                  <BusinessKey KeyName="ADVREF" KeyType="Unknown"
                  KeyValue="AVAGT01" />
                </BusinessKeyVO>
              </value>
            </item>
          </ns9:BusinessKeys>
        </ns9:Activity>
      </ns12:ProcessUIRequest>
    </ns12:ProcessUIRequest>
  </S:Body>
</S:Envelope>
The POJO which is marshalled into that SOAP request is:
<tcp.ssgbase.BaseVO>
  <modelData>
    <transactionData class="tcp.ssgview.app.QuoteLoadTxnDataVO">
      <applicationReference>20000003CR3.00000003</applicationReference>
    </transactionData>
  </modelData>
  <activity>
    <businessKeys>
      <item>
        <tcp.serializable__dictionary.BusinessKeyItem>
          <key>
            <string>ADVREF</string>
          </key>
          <value>
            <businessKeyVO>
              <businessKey>
                <keyName>ADVREF</keyName>
                <keyValue>AVAGT01</keyValue>
                <keyType>Unknown</keyType>
              </businessKey>
              <keyName>ADVREF</keyName>
              <keyValue>AVAGT01</keyValue>
            </businessKeyVO>
          </value>
        </tcp.serializable__dictionary.BusinessKeyItem>
      </item>
    </businessKeys>
    <actionMode>DEFAULT</actionMode>
    <activityMode>DEFAULT</activityMode>
    <activityTransaction>START_NEW_ACTIVITY_AND_LOG_OFF_USER</activityTransaction>
    <actionCode>QuoteLoad</actionCode>
    <activityReference></activityReference>
    <activityStatus>INITAL</activityStatus>
    <activityCode>QuoteApplicationFull</activityCode>
    <canProceedWithValidationsOutstanding>true</canProceedWithValidationsOutstanding>
  </activity>
  <displayError>false</displayError>
  <isAnonymous>false</isAnonymous>
  <isError>false</isError>
  <isCompactRequest>false</isCompactRequest>
  <callType>SUBMIT</callType>
</tcp.ssgbase.BaseVO>
The SOAP request generated by the actual web application is:
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
  <soapenv:Body>
    <ns2:ProcessUIRequest xmlns:ns2="http://zzz/yyywebservice/v5/types/">
      <processUIRequest>
        <activity>
          <actionCode>QuoteLoad</actionCode>
          <actionMode>DEFAULT</actionMode>
          <activityCode>QuoteApplicationFull</activityCode>
          <activityMode>DEFAULT</activityMode>
          <activityReference />
          <activityStatus>INITAL</activityStatus>
          <activityTransaction>
          START_NEW_ACTIVITY_AND_LOG_OFF_USER</activityTransaction>
          <businessKeys />
          <canProceedWithValidationsOutstanding>
          true</canProceedWithValidationsOutstanding>
        </activity>
        <callType>SUBMIT</callType>
        <displayError>false</displayError>
        <isAnonymous>false</isAnonymous>
        <isCompactRequest>false</isCompactRequest>
        <isError>false</isError>
        <modelData>
          <transactionData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:type="ns2:quoteLoadTxnDataVO">
            <applicationReference>
            20000003ESF.00000018</applicationReference>
          </transactionData>
        </modelData>
      </processUIRequest>
    </ns2:ProcessUIRequest>
  </soapenv:Body>
</soapenv:Envelope>
The POJO which is marshalled into that SOAP request is:
<tcp.ssgbase.BaseVO>
  <modelData>
    <transactionData class="tcp.ssgview.app.QuoteLoadTxnDataVO">
      <applicationReference>20000003ESF.00000018</applicationReference>
    </transactionData>
  </modelData>
  <activity>
    <businessKeys>
      <item>
        <tcp.serializable__dictionary.BusinessKeyItem>
          <key>
            <string>ADVREF</string>
          </key>
          <value>
            <businessKeyVO>
              <businessKey>
                <keyName>ADVREF</keyName>
                <keyValue>AVAGT01</keyValue>
                <keyType>Unknown</keyType>
              </businessKey>
              <keyName>ADVREF</keyName>
              <keyValue>AVAGT01</keyValue>
            </businessKeyVO>
          </value>
        </tcp.serializable__dictionary.BusinessKeyItem>
      </item>
    </businessKeys>
    <actionMode>DEFAULT</actionMode>
    <activityMode>DEFAULT</activityMode>
    <activityTransaction>START_NEW_ACTIVITY_AND_LOG_OFF_USER</activityTransaction>
    <actionCode>QuoteLoad</actionCode>
    <activityReference></activityReference>
    <activityStatus>INITAL</activityStatus>
    <activityCode>QuoteApplicationFull</activityCode>
    <canProceedWithValidationsOutstanding>true</canProceedWithValidationsOutstanding>
  </activity>
  <displayError>false</displayError>
  <isAnonymous>false</isAnonymous>
  <isError>false</isError>
  <isCompactRequest>false</isCompactRequest>
  <callType>SUBMIT</callType>
</tcp.ssgbase.BaseVO>

You can see that the structure of the two requests are different even though the code being
executed in our integration JARs is exactly the same and the structure of the POJOs used to
create the SOAP message is the same (barring one value).  The message produced by the integration
test is the correct one.  If you look at the structure of the <activity> object in each
message, you can see that in the message produced by the integration test, the majority of
the data is produced as attributes, whereas in the message produced by the web app contains
everything as actual child nodes of activity.  As per the WSDL and XSD definition of the web
service interface, the request produced by the integration test is correct.
Our code to generate the correct service endpoint interface implementation is:
private <T> T createServiceObject(final Class<T> p_seiClass) throws ApplicationException
{
        try {
            final Service serviceFactory = Service.create(new URL(wsdlLocation), new QName(targetNamespace,
serviceName));

            final SoapHandlerResolver handlerResolver = new SoapHandlerResolver();
            handlerResolver.addHandler(new SoapMessageLoggingHandler());
            serviceFactory.setHandlerResolver(handlerResolver);

            final T service = serviceFactory.getPort(p_seiClass);
            ((BindingProvider) service).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                "endpoint");

            return service;
        } catch (MalformedURLException e) {
            throw new ApplicationException(ApplicationErrorCode.COMM_ERR_UNEXPECTED_ERROR,
e);
        }
    }
The only difference I have noticed between running our integration test and running via the
web application is the instance of the service object that is created via serviceFactory.getPort.
We run the integration test via jUnit in Eclipse and it uses standard Java libraries from
the JRE configured in Eclipse to load the required service object.
The web application is running on WebSphere Application Server and when the serviceFactory.getPort
method call returns an instance of the org.apache.axis2.jaxws.client.proxy.JASWXProxyHandler
as the type of the service object.
So it looks to me as if the Axis2 implementation of making the service call is not picking
the up the correct WSDL definition and thus is not serialising the request POJO into the request
SOAP message.
I've used the same mechanism to call many other web services before and never had this problem.
Does anyone have any ideas as to what the underlying issue could be?  Or any pointers as to
where I could investigate further?  I'm at a bit of a dead end at the moment.
Thanks for your help in advance.
Euan


 		 	   		  
Mime
View raw message