facebook

6.6 New Web Service Client does not work

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

    wkande
    Member

    Last week while using MyEclipse 6.5 and building JAX-WS services everything was fine. I created services and create clients. Then I got 6.6 and everything sort of went south. All one needs to do is follow the simple JAX-WS tutorial provided by MyEclipse Welcome page.

    You can create a Web Service just fine, even add more methods to it. Using SoapUI the services run just fine hosted by MyEclpiseAppServer (default). In fact I used a new Workspace and did not change any MyEclipse defaults.

    If you use the MyEclipse Web Services Explorer everything works just fine, just as SoapUI.

    But when you try to create a new “Web Service Client” as the tutorial says and as I have numerous times it fails. This is trying to create the Client from a URL, using the file works fine. The wizard appears to be upset with the xsd file but references elements in the wsdl file.

    The Errors:
    1. Referenced file contains errors (http://localhost:8080/cosmic/CalculatorPort?wsdl
    2. The part ‘parameters’ has an invalid value ‘addResponse’ defined for its element. Element declarations must refer to valid values defined in a schema.
    3. The part ‘parameters’ has an invalid value ‘add’ defined for its element. Element declarations must refer to valid values defined in a schema.
    4. The part ‘parameters’ has an invalid value ‘subtractResponse’ defined for its element. Element declarations must refer to valid values defined in a schema.
    5. The part ‘parameters’ has an invalid value ‘subtract’ defined for its element. Element declarations must refer to valid values defined in a schema.

    After I got frustrated I uninstall 6.6 and re-install 6.5 and now 6.5 does it. So either there is something left behind by 6.6 or I just don’t know what I am doing. Problem is the tutorial fails.

    WSDL and XSD file below

    Anyone seen this and can offer some advise?

    Thanks,
    Warren

    <?xml version="1.0" encoding="UTF-8"?>
    <!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-hudson-390-. -->
    <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://com/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CalculatorService" targetNamespace="http://com/">
      <types>
        <xsd:schema>
          <xsd:import namespace="http://com/" schemaLocation="CalculatorService_schema1.xsd"/>
        </xsd:schema>
      </types>
      <message name="add">
        <part element="tns:add" name="parameters"/>
      </message>
      <message name="addResponse">
        <part element="tns:addResponse" name="parameters"/>
      </message>
      <message name="subtract">
        <part element="tns:subtract" name="parameters"/>
      </message>
      <message name="subtractResponse">
        <part element="tns:subtractResponse" name="parameters"/>
      </message>
      <portType name="CalculatorDelegate">
        <operation name="add">
          <input message="tns:add"/>
          <output message="tns:addResponse"/>
        </operation>
        <operation name="subtract">
          <input message="tns:subtract"/>
          <output message="tns:subtractResponse"/>
        </operation>
      </portType>
      <binding name="CalculatorPortBinding" type="tns:CalculatorDelegate">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="add">
          <soap:operation soapAction=""/>
          <input>
            <soap:body use="literal"/>
          </input>
          <output>
            <soap:body use="literal"/>
          </output>
        </operation>
        <operation name="subtract">
          <soap:operation soapAction=""/>
          <input>
            <soap:body use="literal"/>
          </input>
          <output>
            <soap:body use="literal"/>
          </output>
        </operation>
      </binding>
      <service name="CalculatorService">
        <port binding="tns:CalculatorPortBinding" name="CalculatorPort">
          <soap:address location="http://localhost:8080/cosmic/CalculatorPort"/>
        </port>
      </service>
    </definitions>
    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://com/" targetNamespace="http://com/" version="1.0">
    
      <xs:element name="add" type="tns:add"/>
    
      <xs:element name="addResponse" type="tns:addResponse"/>
    
      <xs:element name="subtract" type="tns:subtract"/>
    
      <xs:element name="subtractResponse" type="tns:subtractResponse"/>
    
      <xs:complexType name="subtract">
        <xs:sequence>
          <xs:element name="arg0" type="xs:int"/>
          <xs:element name="arg1" type="xs:int"/>
        </xs:sequence>
      </xs:complexType>
    
      <xs:complexType name="subtractResponse">
        <xs:sequence>
          <xs:element name="return" type="xs:int"/>
        </xs:sequence>
      </xs:complexType>
    
      <xs:complexType name="add">
        <xs:sequence>
          <xs:element name="arg0" type="xs:int"/>
          <xs:element name="arg1" type="xs:int"/>
        </xs:sequence>
      </xs:complexType>
    
      <xs:complexType name="addResponse">
        <xs:sequence>
          <xs:element name="return" type="xs:int"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
    
    #291016 Reply

    kumar
    Member

    Hi I opened wsdl-mime.xsd which at location
    C:/Users/kumar/AppData/Local/MyEclipse6.5/myeclipse/eclipse/plugins/org.eclipse.wst.standard.schemas_1.0.1.zmyeclipse660200810/xsd/wsdl-mime.xsd

    And modified

    <extension base=”wsdl:tExtensibilityElement”>
    <sequence/>
    <attribute name=”type” type=”string” use=”optional”/>
    <attribute name=”part” type=”NMTOKEN” use=”required “/>
    </extension>

    TO

    <extension base=”wsdl:tExtensibilityElement”>
    <sequence/>
    <attribute name=”type” type=”string” use=”optional”/>
    <attribute name=”part” type=”NMTOKEN” use=”optional”/>
    </extension>

    It got validation correct but after doing this it started throwing me error as

    Property “Any ” is already defined. Use <Jaxb:property> to resolve this conflict.

    So stuck there …-:) . But i am sure your problem will get resolved if you change <attribute name=”part” type=”NMTOKEN” use=”required “/>

    To
    <attribute name=”part” type=”NMTOKEN” use=”optional”/>

    Good Luck

    Kumar

    #291020 Reply

    wkande
    Member

    Thanks for the advice but it did not do the trick. I did find one thing that helped. Changing localhost to 127.0.0.1 in the address caused the errors to go away. But then I added a new method to the Web Service, tried to re-generated the Web Service Client and get the same error for the new method only. I then removed the new method and the Web Service Client would again re-generate without errors.

    Very odd!

    #291032 Reply

    wkande
    Member

    It now appears that the errors go away if you use only a fully qualified address such as the ip address if the Web Service Client wizard is reading a URL on the local machine.

    #291060 Reply

    Pradeep_J
    Member

    @wkande wrote:

    It now appears that the errors go away if you use only a fully qualified address such as the ip address if the Web Service Client wizard is reading a URL on the local machine.

    hi My Client part in HelloWorld is not working

    The Error is Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/commons/httpclient/methods/RequestEntity
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getConstructor(Unknown Source)
    at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:108)
    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 $Proxy0.example(Unknown Source)
    at com.genuitec.myeclipse.wsexaple.client.HelloWorldClient.main(HelloWorldClient.java:30)
    Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.methods.RequestEntity
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    … 14 more

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: 6.6 New Web Service Client does not work

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