facebook

[Closed] Unable to CALL Top-Down Web Service/XFire1.2.4

  1. MyEclipse Archived
  2.  > 
  3. Web Services
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #267820 Reply

    Russ
    Member

    This is a continuation of some the issues I am going through just to get a web service running using a basic approach. This is a 100% MyEclipse generated web service. It also includes a web service client.

    The WSDL looks like the below code below. It is not a very complex service.

    
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                      xmlns:tns="http://webservice.prod.dept.company.com/JBossWebService/" 
                      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                      name="JBossWebService" 
                      targetNamespace="http://webservice.prod.dept.company.com/JBossWebService/">
    <wsdl:types>
        <xsd:schema targetNamespace="http://webservice.prod.dept.company.com/JBossWebService/">
            <xsd:element name="getTaskDetails">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="userId" type="xsd:string"/>
                        <xsd:element name="taskId" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="getTaskDetailsResponse">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="getTaskDetailsResults" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </wsdl:types>
    
    
    <wsdl:message name="getTaskDetailsRequest">
        <wsdl:part element="tns:getTaskDetails" name="parameters"/>
    </wsdl:message>
    
    <wsdl:message name="getTaskDetailsResponse">
        <wsdl:part element="tns:getTaskDetailsResponse" name="parameters"/>
    </wsdl:message>
    
    <wsdl:portType name="JBossWebService">
        <wsdl:operation name="getTaskDetails">
            <wsdl:input message="tns:getTaskDetailsRequest"/>
            <wsdl:output message="tns:getTaskDetailsResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    
    
    <wsdl:binding name="JBossWebServiceSOAP" type="tns:JBossWebService">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
            <wsdl:operation name="getTaskDetails">
                <soap:operation soapAction="http://webservice.prod.dept.company.com/JBossWebService/getTaskDetails"/>
                    <wsdl:input>
                        <soap:body use="literal"/>
                    </wsdl:input>
                    <wsdl:output>
                        <soap:body use="literal"/>
                    </wsdl:output>
            </wsdl:operation>
    </wsdl:binding>
    
    
    <wsdl:service name="JBossWebService">
        <wsdl:port binding="tns:JBossWebServiceSOAP" name="JBossWebServiceSOAP">
            <soap:address location="http://localhost:8080/JBOSSWebService/services/JBossWebService"/>
        </wsdl:port>
    </wsdl:service>
    
    </wsdl:definitions>
    

    This is the services.xml file. Note this is the basic configuration created in a project. When you change the use element to “wrapped,” one is not able to test the service by touching the WSDL’s url because the server reports an invalid style use combination.

    
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://xfire.codehaus.org/config/1.0">
        <service>
            <name>JBossWebService</name>
            <namespace>http://webservice.prod.dept.company.com/JBossWebService/</namespace>
            <serviceClass>com.company.dept.prod.webservice.JBossWebServiceImpl</serviceClass>
            <serviceFactory>org.codehaus.xfire.jaxb2.JaxbServiceFactory</serviceFactory>
            <style>document</style>
            <use>literal</use>
            <scope>application</scope>
        </service>
    </beans>
    

    When I try to run the service using the Web Service Explorer, I get the below fault:

    
    <soap:Envelope>
        <soap:Body>
           <soap:Fault>
               <faultcode>soap:Client</faultcode>
               <faultstring>Parameter {http://webservice.prod.dept.company.com/JBossWebService/}getTaskDetails does not exist!</faultstring>
          </soap:Fault>
       </soap:Body>
    </soap:Envelope>
    

    When I try running the two client’s (one generated by MyEclipse and one I created) I am still blocked and get the same error.

    
    Exception in thread "main" java.lang.NoSuchMethodError: org.apache.commons.httpclient.MultiThreadedHttpConnectionManager.setParams(Lorg/apache/commons/httpclient/params/HttpConnectionManagerParams;)V
        at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.createClient(CommonsHttpMessageSender.java:198)
        at org.codehaus.xfire.transport.http.CommonsHttpMessageSender.open(CommonsHttpMessageSender.java:113)
        at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:121)
        at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
        at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
        at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
        at org.codehaus.xfire.client.Client.invoke(Client.java:335)
        at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at $Proxy8.getTaskDetails(Unknown Source)
        at com.company.dept.prod.webservice.client.JBossWebServiceClient.callWebService(JBossWebServiceClient.java:173)
        at com.company.dept.prod.webservice.client.JBossWebServiceClient.main(JBossWebServiceClient.java:196)
    

    Any help and suggestions would be greatly appreciated as I try to work through getting a web service up and running using XFire. 🙄

    #267841 Reply

    Russ
    Member

    Okay, I have FINALLY got the Web Service Explorer working………

    The root problem was the services.xml file had the wrong style/use as tomeksz had suggested earlier!!!!!

    This is the services.xml file:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://xfire.codehaus.org/config/1.0">
          <service>
        <name>JBossWebService</name>
        <namespace>http://webservice.prod.dept.company.com/JBossWebService/</namespace>
        <serviceClass>com.company.dept.prod.webservice.JBossWebServiceImpl</serviceClass>
        <serviceFactory>org.codehaus.xfire.jaxb2.JaxbServiceFactory</serviceFactory>
        <style>wrapped</style>
        <use>literal</use>
        <scope>application</scope>
         </service>
    </beans>
    

    I am using this as the WSDL

    
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                      xmlns:tns="http://webservice.prod.dept.company.com/JBossWebService/" 
                      xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                      xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                      name="JBossWebService" 
                      targetNamespace="http://webservice.prod.dept.company.com/JBossWebService/">
    <wsdl:types>
        <xsd:schema targetNamespace="http://webservice.prod.dept.company.com/JBossWebService/">
            <xsd:element name="getTaskDetails">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="userId" type="xsd:string"/>
                        <xsd:element name="taskId" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
            <xsd:element name="getTaskDetailsResponse">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="getTaskDetailsResults" type="xsd:string"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </wsdl:types>
    
    
    <wsdl:message name="getTaskDetailsRequest">
        <wsdl:part element="tns:getTaskDetails" name="parameters"/>
    </wsdl:message>
    
    <wsdl:message name="getTaskDetailsResponse">
        <wsdl:part element="tns:getTaskDetailsResponse" name="parameters"/>
    </wsdl:message>
    
    <wsdl:portType name="JBossWebService">
        <wsdl:operation name="getTaskDetails">
            <wsdl:input message="tns:getTaskDetailsRequest"/>
            <wsdl:output message="tns:getTaskDetailsResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    
    
    <wsdl:binding name="JBossWebServiceSOAP" type="tns:JBossWebService">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
            <wsdl:operation name="getTaskDetails">
                <soap:operation soapAction="http://webservice.prod.dept.company.com/JBossWebService/getTaskDetails"/>
                    <wsdl:input>
                        <soap:body use="literal"/>
                    </wsdl:input>
                    <wsdl:output>
                        <soap:body use="literal"/>
                    </wsdl:output>
            </wsdl:operation>
    </wsdl:binding>
    
    
    <wsdl:service name="JBossWebService">
        <wsdl:port binding="tns:JBossWebServiceSOAP" name="JBossWebServiceSOAP">
            <soap:address location="http://localhost:8080/JBOSSWebService/services/JBossWebService"/>
        </wsdl:port>
    </wsdl:service>
    
    </wsdl:definitions>
    

    One issue resolved one to go! 😀 Thanks for your help thus far……..

    Russ

    #267844 Reply

    Russ
    Member

    Okay…….. the client is working now……………..

    The issue was in the application there was an outdated common-http-client jar file…. Once I updated the jar file….ALL is working from the CLIENT…..

    WE ARE ROCKING NOW>>>>>>>>> 🙂

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: [Closed] Unable to CALL Top-Down Web Service/XFire1.2.4

You must be logged in to post in the forum log in