facebook

Web Service Client Fails

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

    Russ
    Member

    OKay, I have tried it using XFire and I still can not get the client to work……….

    I took the bottom-up approach and removed the WSDL all together……. I let the server/X-Fire generate the WSDL for me……….Next, I deployed the new service and checked to ensure it was running by touching the WSDL using the URL. I took the WSDL from the browser and rebuilt a new web service using X-Fire….top-down approach. I implemented one method in the new Web service Impl class ensuring it was working correctly. I checked the services.xml and web.xml to ensure they were set appropriately.

    I am getting the below error…….Grrrrrrrrrrrrrrrr Obviously, I am trying to hard………

    This is a simple call passing two parameters. I checked the WSDL, the PortType ObjectFactory Classes… The second parameter is there….. I am using the JAXB1.2 implementation…….

    
    Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Parameter getTaskDetailsin1 does not exist!
    org.codehaus.xfire.fault.XFireFault: Parameter getTaskDetailsin1 does not exist!
        at org.codehaus.xfire.fault.Soap11FaultSerializer.readMessage(Soap11FaultSerializer.java:31)
        at org.codehaus.xfire.fault.SoapFaultSerializer.readMessage(SoapFaultSerializer.java:28)
        at org.codehaus.xfire.soap.handler.ReadHeadersHandler.checkForFault(ReadHeadersHandler.java:111)
        at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:67)
        at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:382)
        at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
        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.WebServiceBeanClient.main(WebServiceBeanClient.java:130)
    

    I have used tcpmon and the information is getting to the server and a fault is being thrown………

    Call the Fire Dept..I’m steaming!

    #267371 Reply

    tomeksz
    Member

    Can you post your wsdl ( or just the part which describe method params ) and your client config ?

    #267381 Reply

    Russ
    Member

    okay… I’ve pulled alot of information from the WSDL and only focused on the specific section I can not get working……

    
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions targetNamespace="http://webservice.prod.dept.company.com" 
                             xmlns:tns="http://webservice.prod.dept.company.com" 
                             xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
                             xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" 
                             xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                             xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" 
                             xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" 
                             xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" 
                             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
        <wsdl:types>
            <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                                                attributeFormDefault="qualified" 
                                                elementFormDefault="qualified" 
                                                targetNamespace="http://webservice.prod.dept.company.com">
                <xsd:element name="getTaskDetailsin0" type="xsd:string"/>
                <xsd:element name="getTaskDetailsin1" type="xsd:string"/>
                <xsd:element name="getTaskDetailsout" type="xsd:string"/>
            </xsd:schema>
        </wsdl:types>
        <wsdl:message name="getTaskDetailsResponse">
            <wsdl:part name="getTaskDetailsout" element="tns:getTaskDetailsout"/>
        </wsdl:message>
        <wsdl:message name="getTaskDetailsRequest">
            <wsdl:part name="getTaskDetailsin0" element="tns:getTaskDetailsin0"/>
            <wsdl:part name="getTaskDetailsin1" element="tns:getTaskDetailsin1"/>
        </wsdl:message>
        <wsdl:portType name="WebServiceBeanPortType">
            <wsdl:operation name="getTaskDetails">
                <wsdl:input name="getTaskDetailsRequest" message="tns:getTaskDetailsRequest"/>
                <wsdl:output name="getTaskDetailsResponse" message="tns:getTaskDetailsResponse"/>
            </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="WebServiceBeanHttpBinding" type="tns:WebServiceBeanPortType">
            <wsdl:operation name="getTaskDetails">
                <wsdlsoap:operation soapAction=""/>
                <wsdl:input name="getTaskDetailsRequest">
                    <wsdlsoap:body use="literal"/>
                </wsdl:input>
                <wsdl:output name="getTaskDetailsResponse">
                    <wsdlsoap:body use="literal"/>
                </wsdl:output>
            </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="WebServiceBean">
            <wsdl:port name="WebServiceBeanHttpPort" binding="tns:WebServiceBeanHttpBinding">
                <wsdlsoap:address location="http://<machine name>:8080/JBossWebService/services/WebServiceBean"/>
            </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
    

    When I try to create a web service with just this one method, MyEclipse/XFire creates a Client and ObjectFacotry instead of the WebServiceBeanImpl and WebServiceBeanPortType!!!!!

    I don have a client-config.xml for JBoss… I am running MyExclipse and I am letting the IDE create the client using the WSDL.

    #267383 Reply

    tomeksz
    Member

    By client config i mean XFire client configuration and maybe service interface 🙂 Can you also post soap message ?.
    The problem can be caused by e.g. invalid namespace set on message or problem with finding valid method to call.
    Btw: are you using JAXB1.2? I think generator supports only jaxb2

    #267390 Reply

    Russ
    Member

    The Client was created as a Web Project. The WSDL was copied over to this project under the WEB-INF/wsdl directory. Next, I create the Web Service client using this WSDL. MyEclipse generates the PortType and client classes for me. I know this works as I have another web services working this same way. I have JAXB1.2 libraries only in the projects.

    This is the interface:

    
    package com.company.dept.prod.webservice;
    
    import javax.jws.WebMethod;
    import javax.jws.WebParam;
    import javax.jws.WebResult;
    import javax.jws.WebService;
    import javax.jws.soap.SOAPBinding;
    import javax.xml.datatype.XMLGregorianCalendar;
    
    @WebService(name = "WebServiceBeanPortType", targetNamespace = "http://webservice.prod.dept.company.com")
    @SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.BARE)
    public interface WebServiceBeanPortType {
    
        @WebMethod(operationName = "getTaskDetails", action = "")
        @WebResult(name = "getTaskDetailsout", targetNamespace = "http://webservice.prod.dept.company.com")
        public String getTaskDetails(
                @WebParam(name = "getTaskDetailsin0", targetNamespace = "http://webservice.prod.dept.company.com")
                String getTaskDetailsin0,
                @WebParam(name = "getTaskDetailsin1", targetNamespace = "http://webservice.prod.dept.company.com")
                String getTaskDetailsin1);
    
    }
    

    This is the SOAP message being sent……….

    
    POST /JBossWebService/services/WebServiceBean HTTP/1.1
    SOAPAction: ""
    Content-Type: text/xml; charset=UTF-8
    User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; XFire Client +http://xfire.codehaus.org)
    Host: <computer-name>:8181
    Expect: 100-continue
    Content-Length: 350
    
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
                            xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body>
        <getTaskDetailsin0 xmlns="http://webservice.prod.dept.company.com">blah blah</getTaskDetailsin0>
                <getTaskDetailsin1>12345678910</getTaskDetailsin1>
    </soap:Body>
    </soap:Envelope>
    

    You can see the namespace is missing from the second parameter for the inputs. When I edited the message within tcpmon and re-send the message……..This is what I get

    
    HTTP/1.1 100 Continue
    
    HTTP/1.1 500 Internal Server Error
    Server: Apache-Coyote/1.1
    X-Powered-By: Servlet 2.4; JBoss-4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)/Tomcat-5.5
    Content-Type: text/xml;charset=UTF-8
    Transfer-Encoding: chunked
    Date: Wed, 14 Mar 2007 18:03:22 GMT
    Connection: close
    
    1ef
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Error parsing document.. Nested exception is com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '=' (code 61) excepted space, or '>' or "/>"
     at [row,col {unknown-source}]: [1,296]</faultstring></soap:Fault></soap:Body></soap:Envelope>
    0
    

    This is the location is where I added the namespace for the second parameter.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Web Service Client Fails

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