Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-2352

invoking webservices client from another environment is getting org.apache.axis2.AxisFault: First Element must contain the local name, Envelope

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 1.3
    • 1.3
    • client-api, codegen, wsdl
    • None
    • Linux, JDK 1.5.0_06, JBoss App Server.

    Description

      This does not seem to be related to the REST problem mentioned in some of the other issues. since on the server side (a non-Axis server) I see the following:

      POST / HTTP/1.1

      SOAPAction: "bookstore.echoMe"

      User-Agent: Axis2

      Host: localhost:4444

      Transfer-Encoding: chunked

      Content-Type: text/xml; charset=UTF-8

      [Fatal Error] :-1:-1: Premature end of file.

      This is the process I followed:

      I installed the said version of Axis2 today.
      I have my own wsdl (produced below).
      I set up JAVA_HOME, AXIS2_HOME.
      Then I ran:
      c:\axis2-1.1.1\bin\wsdl2java.bat -f -d xmlbeans -uri c:\wsdl\bookstore.wsdl
      which produced dirs/files under my current directory.
      Then I wrote a client class to invoke the operation (produced below).
      When I run it I get this exception on the client side I get the following exception.

      org.apache.axis2.AxisFault: First Element must contain the local name, Envelope; nested exception is:
      org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope
      at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:126)
      at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
      at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:252)
      at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
      at bookstore.BookstoreStub.echoMe(BookstoreStub.java:141)
      at client_pkg.MyAxisClient.thisEchoMe(MyAxisClient.java:43)
      at client_pkg.MyAxisClient.main(MyAxisClient.java:22)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
      Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope
      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:217)
      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:175)
      at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:120)
      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:159)
      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.identifySOAPVersion(StAXSOAPModelBuilder.java:133)
      at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:108)
      at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:120)
      ... 11 more

      Here is the wsdl file:

      <definitions name="bookstoredefinitions" targetNamespace="bookstore" xmlns:tns="bookstore" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
      <types>
      <xsd:schema targetNamespace="bookstore" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="bookstore">
      <xsd:element name="echoMe">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="AuthorName">
      <xsd:complexType>
      <xsd:attribute name="Value" type="xsd:string"/>
      </xsd:complexType>
      </xsd:element>
      <xsd:element name="BookName">
      <xsd:complexType>
      <xsd:attribute name="Value" type="xsd:string"/>
      </xsd:complexType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      <xsd:element name="echoMeResponse">
      <xsd:complexType>
      <xsd:sequence>
      <xsd:element name="AuthorName">
      <xsd:complexType>
      <xsd:attribute name="Value" type="xsd:string"/>
      </xsd:complexType>
      </xsd:element>
      <xsd:element name="BookName">
      <xsd:complexType>
      <xsd:attribute name="Value" type="xsd:string"/>
      </xsd:complexType>
      </xsd:element>
      </xsd:sequence>
      </xsd:complexType>
      </xsd:element>
      </xsd:schema>
      </types>
      <message name="echoMe">
      <part name="parameters" element="tns:echoMe"/>
      </message>
      <message name="echoMeResponse">
      <part name="parameters" element="tns:echoMeResponse"/>
      </message>
      <portType name="bookstoreportType">
      <operation name="echoMe">
      <input message="tns:echoMe" />
      <output message="tns:echoMeResponse" />
      </operation>
      </portType>
      <binding name="bookstorebinding" type="tns:bookstoreportType">
      <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="echoMe">
      <soap:operation soapAction="bookstore.echoMe"/>
      <input>
      <soap:body use="literal"/>
      </input>
      <output>
      <soap:body use="literal"/>
      </output>
      </operation>
      </binding>
      <service name="bookstore">
      <port binding="tns:bookstorebinding" name="bookstoreport">
      <soap:address location="http://localhost:4444"/>
      </port>
      </service>
      </definitions>

      Is there a way I can include all the generated files?

      Here is the client code:

      package client_pkg;

      import bookstore.BookstoreStub;
      import bookstore.EchoMeDocument;
      import bookstore.EchoMeResponseDocument;
      import bookstore.impl.EchoMeDocumentImpl;
      import org.apache.xmlbeans.XmlOptions;

      public class MyAxisClient
      {
      public static void main( String args[] ) throws Exception

      { BookstoreStub stub = new BookstoreStub(); thisEchoMe(stub); }

      public static void thisEchoMe(BookstoreStub stub)
      {
      try

      { EchoMeDocument reqDoc = EchoMeDocument.Factory.newInstance(); EchoMeDocument.EchoMe req = reqDoc.addNewEchoMe(); EchoMeDocument.EchoMe.AuthorName aname = req.addNewAuthorName(); aname.setValue("AuthorZ"); EchoMeDocument.EchoMe.BookName bname = req.addNewBookName(); bname.setValue("BookZ"); stub.echoMe(reqDoc); }

      catch (Exception e)

      { e.printStackTrace(); System.out.println("\n\n\n"); }

      }

      }

      Please let me know if you need to know anything else.

      Attachments

        1. TestWS.zip
          41 kB
          Raghu Upadhyayula
        2. axis2.log
          155 kB
          Raghu Upadhyayula

        Activity

          People

            amilachinthaka Amila Chinthaka Suriarachchi
            raghu Raghuram Rajah
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: