[
https://issues.apache.org/jira/browse/AXIS2-2352?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Raghu updated AXIS2-2352:
-------------------------
Then I tried the AXIOM model for the client (server is still non-Axiom):
public static void tryAxiomClient()
{
try {
OMElement getBookPayload = getBookPayload("Imauthor", "ImTitle");
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
ServiceClient sender = new ServiceClient();
sender.setOptions(options);
System.err.println("payload: " + getBookPayload.toString());
OMElement result = sender.sendReceive(getBookPayload);
//String response = result.getFirstElement().getText();
System.err.println("Response: " + result.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
public static OMElement getBookPayload(String author, String title)
{
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace(
"bookstore", "tns");
OMElement method = fac.createOMElement("echoMe", omNs);
OMElement authorElement = fac.createOMElement("AuthorName", omNs);
authorElement.addAttribute("Value", author, omNs);
method.addChild(authorElement);
OMElement titleElement = fac.createOMElement("TitleName", omNs);
titleElement.addAttribute("Value", title, omNs);
method.addChild(titleElement);
return method;
}
Here is the output of println of the payload:
payload: <tns:ehcoMe xmlns:tns="bookstore"><tns:AuthorName tns:Value="Imauthor"
/><tns:TitleName tns:Value="ImTitle" /></tns:ehcoMe>
and the exception:
org.apache.axis2.AxisFault: Software caused connection abort: recv failed;
nested exception is:
java.net.SocketException: Software caused connection abort: recv
failed; nested exception is:
org.apache.axis2.AxisFault: Software caused connection abort: recv
failed; nested exception is:
java.net.SocketException: Software caused connection abort: recv failed
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:227)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
at client_pkg.ABPPAxisClient.tryAxiomClient(ABPPAxisClient.java:49)
at client_pkg.ABPPAxisClient.main(ABPPAxisClient.java:35)
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.axis2.AxisFault: Software caused connection abort: recv
failed; nested exception is:
java.net.SocketException: Software caused connection abort: recv failed
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:344)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
... 12 more
Caused by: java.net.SocketException: Software caused connection abort: recv
failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
at
org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
at
org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
at
org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:541)
at
org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:119)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335)
... 13 more
> XMLBeans client getting org.apache.axis2.AxisFault: First Element must
> contain the local name, Envelope
> -------------------------------------------------------------------------------------------------------
>
> Key: AXIS2-2352
> URL: https://issues.apache.org/jira/browse/AXIS2-2352
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: client-api, codegen, wsdl
> Affects Versions: 1.1.1
> Environment: Windows XP, JDK 1.4.2_09
> Reporter: Raghu
>
> 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]