13 Replies Latest reply on Mar 31, 2011 3:20 PM by gmdavidson62

    JaxWsProxyFactoryBean returning null

    gmdavidson62

      I'm trying to connect to an existing/legacy axis external (not hosted in servicemix) web service.  I'm trying to connect to the web service from within code like:

       

       

                JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

                factory.setServiceClass(AbcServiceInterface.class);

                factory.setAddress("http://hodx9024vb:8082/abcesb/services/Decoder");

                      +Map props = factory.getProperties();

                if(props == null){

                     props = new HashMap<String,Object>();

                     props.put("set-jaxb-validation-event-handler", "false");

                     factory.setProperties(props);

                }

                      AbcServiceInterface client = (AbcServiceInterface) factory.create();

                      LOG.info("Results from call: "+client.execute("QUJD"));

       

       

      I have no trouble reaching the web service, and there are no errors.

      However the value returned is always null.

      I've looked everywhere....tried everything...any ideas?

      Thanks for the help!!!

      -


      Interface class:

       

      package com.infarmbureau.esb;

       

      import javax.jws.WebMethod;

      import javax.jws.WebParam;

      import javax.jws.WebService;

       

       

      @WebService(targetNamespace = "http://esb-dev1:9081/abcesb/services/Decoder", name = "Decoder")

      public interface AbcServiceInterface {

            

           @WebMethod

           public String execute(@WebParam(name = "returnValue") String returnValue);

       

      }

      -


      WSDL generated by hitting this web service

      <?xml version="1.0" encoding="UTF-8"?>

      <wsdl:definitions targetNamespace="http://esb-dev1:9081/abcesb/services/Decoder" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://esb-dev1:9081/abcesb/services/Decoder" xmlns:intf="http://esb-dev1:9081/abcesb/services/Decoder" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <!--WSDL created by Apache Axis version: 1.4

      Built on Apr 22, 2006 (06:55:48 PDT)-->

         <wsdl:message name="executeResponse">

            <wsdl:part name="executeReturn" type="xsd:string"/>

         </wsdl:message>

         <wsdl:message name="executeRequest">

            <wsdl:part name="PayLoad" type="xsd:string"/>

         </wsdl:message>

       

         <wsdl:portType name="Decoder">

            <wsdl:operation name="execute" parameterOrder="PayLoad">

               <wsdl:input message="intf:executeRequest" name="executeRequest"/>

               <wsdl:output message="intf:executeResponse" name="executeResponse"/>

            </wsdl:operation>

         </wsdl:portType>

       

         <wsdl:binding name="DecoderSoapBinding" type="intf:Decoder">

            <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

            <wsdl:operation name="execute">

               <wsdlsoap:operation soapAction=""/>

               <wsdl:input name="executeRequest">

                  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://utils.ws.abc.com" use="encoded"/>

               </wsdl:input>

               <wsdl:output name="executeResponse">

                  <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://esb-dev1:9081/abcesb/services/Decoder" use="encoded"/>

               </wsdl:output>

            </wsdl:operation>

         </wsdl:binding>

          

        <wsdl:service name="DecoderService">

             <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Decoder to decode Base64 text into clear text  </wsdl:documentation>

           <wsdl:port binding="intf:DecoderSoapBinding" name="Decoder">

                <wsdlsoap:address location="http://esb-dev1:9081/abcesb/services/Decoder"/>

           </wsdl:port>

        </wsdl:service>

       

      </wsdl:definitions>

       

      Edited by: gmdavidson62 on Mar 1, 2011 3:35 PM

       

      Edited by: gmdavidson62 on Mar 1, 2011 3:36 PM

        • 1. Re: JaxWsProxyFactoryBean returning null
          ffang

          Hi,

           

          You're using cxf client to connect axis server, the axis server binding is using rpc/encoded style, which is not supported by cxf.

           

          Freeman

          • 2. Re: JaxWsProxyFactoryBean returning null
            gmdavidson62

            Thanks for the response. 

             

            Is there a "best practice" for dealing with legacy axis web services, which use rpc/encoded?

             

            Thanks!

            • 3. Re: JaxWsProxyFactoryBean returning null
              ffang

              Hi,

               

              IMHO, rpc/encoded style is quite old and not in jaxws spec.

              How about rewrite your legacy webservice? So that you can communicate with more modern soap stack.

               

              Freeman

              • 4. Re: JaxWsProxyFactoryBean returning null
                gmdavidson62

                Thanks!

                 

                Well....you are probably correct, and that's what we'll do over time, however not sure that's feasible with our current timeline.

                 

                Since these are old AXIS 1.x web services, is it possible to just wrap the AXIS jars, put them in the OSGI (Fuse) container, then create a proxy, using the AXIS code, for all of these legacy services until we can migrate them?

                 

                I really appreciate the feedback, we will definitely be re-writing these, but just can't do them all right now.

                 

                Again, thanks for the insight!!

                • 5. Re: JaxWsProxyFactoryBean returning null
                  ffang

                  Hi,

                   

                  You can use axis client or other soap stack client which support rpc/encoding style to talk to your axis server.

                   

                  In this case the major work is wrap the axis jar to make them OSGi friendly. Honestly I never tried it before and I have no idea how much effort it would be.

                   

                   

                  Freeman

                  • 6. Re: JaxWsProxyFactoryBean returning null
                    gowtamcs

                    HI, I am not sure if this is the right thread to post it, but I am not able to find the right one.

                     

                    Can you please let me know if CXF Camel allows to generate and use a JAX-WS Client on JDK 1.5 environment. If so could you please provide me some pointers for the same if there is any specific configuration that needs to done to accomplish the same.

                     

                    I really need our help guys. Please do help out.

                     

                    Thanks,

                     

                    Gowtam

                    • 7. Re: JaxWsProxyFactoryBean returning null
                      ffang

                      Hi,

                       

                      You should always create a new discussion thread for new question.

                       

                      For your questions is camel-cxf component related, you should post your question here[1]

                       

                      http://fusesource.com/forums/forum.jspa?forumID=2

                       

                      Freeman

                      • 8. Re: JaxWsProxyFactoryBean returning null
                        gowtamcs

                        Thanks Freeman. I posted it as a new message in the forum link you gave me.

                        • 9. Re: JaxWsProxyFactoryBean returning null
                          jmi

                          Hi,

                           

                          I'm having the same problem of my cxf client getting null object nested in response object (which is not null) from Axis server.

                           

                          Read from you that RPC/encoding of Axis server won't work for CXF client which is document/literal based.

                           

                          Just want to get some confirmation on this to make sure that I didn't mis-understand. If it's true indeed, I don't need to spend more time (already a week spent) on getting my CXF client to work with Axis server.

                           

                          My soap message monitor showed me that response has its nested objects returning fine. It's just that the client couldn't get it.

                           

                          Thanks a lot!

                          Jason

                          • 10. Re: JaxWsProxyFactoryBean returning null
                            ffang

                            Hi,

                             

                            Cxf doesn't support rpc/encoded style, so it won't work with any other stack using rpc/encoded.

                             

                            But it still can work with rpc/literal and document/literal from other soap stack.

                            You need firstly figure out what style your axis server used, if it's rpc/encoded, then cxf can't work with it.

                             

                             

                            Freeman

                            • 11. Re: JaxWsProxyFactoryBean returning null
                              gmdavidson62

                              Actually we were able to get this to work, using:

                               

                              JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();

                              factory.setServiceClass(OurInterface.class);

                               

                              @WebService

                              @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED,

                                        style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.ENCODED

                              )

                              public interface OurInterface {

                                    

                                   @WebMethod

                                   @WebResult(name = "payload", partName = "payload",targetNamespace = "http://somNamespace.com")

                                  String execute(@WebParam(name="payload") String payload);

                               

                              }

                               

                              Here is the WSDL from the AXIS service:

                               

                              <?xml version="1.0" encoding="UTF-8"?>

                              <wsdl:definitions targetNamespace="http://localhost:9082/ourws/services/SomeService"

                                      xmlns:apachesoap="http://xml.apache.org/xml-soap"

                                        xmlns:impl="http://localhost:9082/ourws/services/SomeService"

                                        xmlns:intf="http://localhost:9082/ourws/services/SomeService"

                                        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

                                        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

                                        xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"

                                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">

                              <!--WSDL created by Apache Axis version: 1.4

                              Built on Apr 22, 2006 (06:55:48 PDT)-->

                               

                                 <wsdl:message name="executeRequest">

                                    <wsdl:part name="payload" type="xsd:string"/>

                                 </wsdl:message>

                               

                                 <wsdl:message name="executeResponse">

                                    <wsdl:part name="executeReturn" type="xsd:string"/>

                                 </wsdl:message>

                               

                                 <wsdl:portType name="SomeService">

                                    <wsdl:operation name="execute" parameterOrder="payload">

                                       <wsdl:input message="intf:executeRequest" name="executeRequest"/>

                                       <wsdl:output message="intf:executeResponse" name="executeResponse"/>

                                    </wsdl:operation>

                                 </wsdl:portType>

                               

                                 <wsdl:binding name="SomeServiceSoapBinding" type="intf:SomeService">

                                    <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

                                     <wsdl:operation name="execute">

                                       <wsdlsoap:operation soapAction=""/>

                                       <wsdl:input name="executeRequest">

                                          <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://DefaultNamespace" use="encoded"/>

                                       </wsdl:input>

                                       <wsdl:output name="executeResponse">

                                          <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:9082/ourws/services/SomeService" use="encoded"/>

                                       </wsdl:output>

                                    </wsdl:operation>

                                 </wsdl:binding>

                               

                                 <wsdl:service name="SomeServiceService">

                                    <wsdl:port binding="intf:SomeServiceSoapBinding" name="SomeService">

                                       <wsdlsoap:address location="http://localhost:9082/ourws/services/SomeService"/>

                                    </wsdl:port>

                                 </wsdl:service>

                              </wsdl:definitions>

                              • 12. Re: JaxWsProxyFactoryBean returning null
                                jmi

                                Great it worked for you! I can see your wsdl use rpc/encoded which doesn't seem to be a problem for your CXF client. Did your CXF client uses this axis-generated wsdl for wsdl2java to generate its client stub?

                                 

                                Your executeResponse itself is a string. Mine is an complexType/object which was nested by another object. My response object itself is not null, but the nested one is null.

                                 

                                Somehow, the unmarshalling is not working. I can see from my soap monitor the the server is returning nested objects as response correctly. Just the client couldn't get them right.

                                 

                                Any help would be greatly appreciated!

                                 

                                btw, I changed wsdl to rpc/literal and re-generated server binding java. The re-deployment didn't seem to solve my client problem.

                                 

                                Jason

                                • 13. Re: JaxWsProxyFactoryBean returning null
                                  gmdavidson62

                                  TBH.....I'm just learning this stuff...just a disclaimer.

                                   

                                  We did not work wsdl---->java.  All of our existing web services we have implemented, implement the following interface:

                                   

                                  public String execute(String payload);

                                   

                                  So it was easy for us....to just do the "java first" way.  So our use case is probably

                                  not the same as yours.