facebook

Problem testing XFire web service

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

    jjones7947
    Participant

    Trying to get a webservice up and running. Right now, I’m just bouncing the parameter back and forth. Fought with getting a valid wsdl, but finally got past that.
    WSDL:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions targetNamespace="http://core"
        xmlns:apachesoap="http://xml.apache.org/xml-soap"
        xmlns:impl="http://core" xmlns:intf="http://core"
        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:types>
             <schema elementFormDefault="qualified"
            targetNamespace="http://core"
            xmlns="http://www.w3.org/2001/XMLSchema">
                <element name="convertToHtml">
                    <complexType>
            <sequence>
                <element name="name" type="xsd:string" />
                <element name="document" type="xsd:string" />
            </sequence>
                    </complexType>
                </element>
                <element name="convertToHtmlResponse">
                    <complexType>
            <sequence>
                <element maxOccurs="unbounded"
                  name="convertToHtmlReturn" type="xsd:string" />
            </sequence>
                    </complexType>
                  </element>
            </schema>
        </wsdl:types>
        <wsdl:message name="convertToHtmlResponse">
            <wsdl:part element="impl:convertToHtmlResponse" name="parameters" />
        </wsdl:message>
        <wsdl:message name="convertToHtmlRequest">
            <wsdl:part element="impl:convertToHtml" name="parameters" />
        </wsdl:message>
        <wsdl:portType name="HtmlService">
            <wsdl:operation name="convertToHtml">
                <wsdl:input message="impl:convertToHtmlRequest"
                    name="convertToHtmlRequest" />
                <wsdl:output message="impl:convertToHtmlResponse"
                    name="convertToHtmlResponse" />
            </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="HtmlServiceSoapBinding"
            type="impl:HtmlService">
        <wsdlsoap:binding style="document"
            transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="convertToHtml">
            <wsdlsoap:operation soapAction="" />
            <wsdl:input name="convertToHtmlRequest">
                <wsdlsoap:body use="literal" />
            </wsdl:input>
            <wsdl:output name="convertToHtmlResponse">
                <wsdlsoap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="HtmlService">
            <wsdl:port binding="impl:HtmlServiceSoapBinding"
                name="HtmlService">
        <wsdlsoap:address
            location="http://localhost:8081/HtmlService" />
        </wsdl:port>
        </wsdl:service>
    </wsdl:definitions>
    

    XFire generates a method which take two strings as input and a List as output, which is fine. However, when I attempt to connect with it either throught ws Explorer or the test client I get no joy. I’m running it locally on Tomcat 6 outside of Eclipse. Using the sandbox always gives me headaches. My version of MyEclipse is 6.0.1 GA Pro. Anyway, the errors are as follows:
    WS Explorer:
    IWAB0135E An unexpected error has occurred.
    302
    Moved Temporarily
    Client:
    Jun 12, 2008 9:58:17 AM org.apache.commons.httpclient.HttpMethodDirector isRedirectNeeded
    INFO: Redirect requested but followRedirects is disabled
    test client completed
    Any ideas?
    Thanks,
    Jim

    #285846 Reply

    Loyal Water
    Member
    #285848 Reply

    jjones7947
    Participant

    I found that one and was on the verge of trying it when I looked at the generated classes ConvertToHtml.java and ConvertToHtmlResponse.java at the top there is a comment like:

    
    /**
     * <p>Java class for anonymous complex type.
     * 
     * <p>The following schema fragment specifies the expected content contained within this class.
     * 
     * <pre>
     * <complexType>
     *   <complexContent>
     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
     *       <sequence>
     *         <element name="convertToHtmlReturn" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
     *       </sequence>
     *     </restriction>
     *   </complexContent>
     * </complexType>
     * </pre>
     */
    

    so I used those to align my wsdl with what the class was expection as follows:

    
    <element name="convertToHtmlResponse">
        <complexType>
            <complexContent>
                <restriction base="xsd:anyType">
                    <sequence>
        <element maxOccurs="unbounded" name="convertToHtmlReturn"  type="xsd:string" />
                    </sequence>
                </restriction>
            </complexContent>
        </complexType>
    </element>
    

    that changed my error to:
    org.codehaus.xfire.fault.XFireFault: Parameter {http://core}convertToHtml does not exist!
    so I googled that and came up with this discussion:
    http://www.myeclipseide.com/PNphpBB2-printview-t-16472-start-0.html
    he’s talking about the pitfalls of using a wsdl generated elsewhere in MyEclipse (ME).
    Mine was generated by Axis2 java2wsdl, I had used axis before and knew that it did a good job of this.
    Was driven to that because ME seems to only generate a generic wsdl that I went crazy trying to edit and validate.
    Jim

    #285943 Reply

    Riyad Kalla
    Member

    Jim, we are glad you figured out what was going on. Moving forward MyEclipse will be focusing on supporting industry standards like JAX-WS for web services and our tooling around it is quite nice (starting in the 6.5 release).

    I don’t know if that will change your web services roll-out plans or not, just wanted to make you aware of it.

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Problem testing XFire web service

This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.

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