Title: Content is not allowed in trailing section

Hi Guys,

The Axis problem I had, "Content is not allowed in trailing section" was my mistake.

Axis 1.2.1 is working well on iSeries and Windows ( Java 1.4.2_08 and Java 1.5 )

A job well done to the Axis development guys.

To track down the problem I needed to write a few simple tools and also learned something about how Axis Agent Stub talked to a remote HTTP server.

The simple service was a getDesc operation done in the rpc/encoded style.

String desc = getDesc ( String dept_code )

=========================================================================

The Axis Agent Stub sends the following HTTP request. It is using HTTP protocol version 1.0

POST /cgi-bin/jsmdirect?simple HTTP/1.0

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

Accept: application/soap+xml, application/dime, multipart/related, text/*

User-Agent: Axis/1.2.1

Host: localhost:8081

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: "getDesc"

Content-Length: 446

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:getDesc soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://server.soap.mylaptop.com"><dept_code xsi:type="xsd:string">ADM</dept_code></ns1:getDesc></soapenv:Body></soapenv:Envelope>

=====================================================================================

The attached AxisServer.java is a simple HTTP server that receives the Axis request and sends back the contents of two files as the HTTP response.

I noticed that the Axis Agent Stub ignores the Content-Length property in the HTTP response and reads the socket input stream until the HTTP server closes the socket.

The Content-Length in the http-head.txt does not equal the size of the http-content.xml file content.

Content-Length: 100

If the socket.close() statement in the AxisServer.java is commented out, the server does not close the socket and the Axis Agent Stub will wait on the socket read.

The socket InputStream could be the input source to the SAXParser, so as the HTTP response content arrrives it being parsed.

=====================================================================================

 

-----Original Message-----
From: Alick Buckley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 15 June 2005 5:27 PM
To: [email protected]
Subject: Content is not allowed in trailing section


I been having troubles posting this item.

=========================================================

Hi Guys,

I have been working with Axis 1.2 Final and it has been working well on an IBM iSeries machine.

I have started testing on a Windows machine using Java 1.4.2_08 and I am getting the following error: "Content is not allowed in trailing section"

The Agent stub can call the server, the server receives the request and creates the response, the agent receives the response ( I think it does, but it does not get to my response handler to trace the response SOAP message ) and then fails.

I am using Axis 1.2 Final on the agent and server ends.

I have kept the test sample simple, call operation getDesc, pass the dept code and receive the dept description.

   String desc = getDesc ( String dept_code )

Request

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:getDesc soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://server.soap.mylaptop.com"><dept_code xsi:type="xsd:string">ADM</dept_code></ns1:getDesc></soapenv:Body></soapenv:Envelope>

Response

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:getDescResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://server.soap.mylaptop.com"><ns1:getDescReturn xsi:type="xsd:string">ADMINISTRATOR DEPT</ns1:getDescReturn></ns1:getDescResponse></soapenv:Body></soapenv:Envelope>


I started the test using Java 1.5 and dropped back to 1.4.2_08

I have tried using different Xalan/Xerces versions 2.4.1 and 2.6.0.

I have so far discovered the following.

    iSeries machine 1 ( Agent ) ========> iSeries machine 2 ( Server ) - OK
    iSeries machine 1 ( Agent ) ========> Windows machine 1 ( Server ) - DOES NOT WORK
  
    Microsoft .Net WebService Studio Tool ===> iSeries machine 2 ( Server ) - OK
    Microsoft .Net WebService Studio Tool ===> Windows machine 1 ( Server ) - OK

   Windows machine 1 (Agent) ========> Windows machine 1 (Server ) - DOES NOT WORK

   Windows machine 1 (Agent) ========> iSeries machine 2 ( Server ) - OK

The SOAP response traced by my program looks identicial and the HTTP protocol header are nearly identical, expect that the Server property are different and IIS adds an  X-Powered-By: ASP.NET property

One is Server: Microsoft-IIS/5.1 and the other is Server: IBM-HTTP-Server/1.0


===================================================================================================

Create trace file : SOAP_REQUEST000001.XML

SOAP fault code   : {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
SOAP fault actor  : null
SOAP fault string : java.lang.RuntimeException: Exception in preInvoke : javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: Content is not allowed in trailing section.

Fault detail : 0
<?xml version="1.0" encoding="utf-8"?>
<stackTrace>java.lang.RuntimeException: Exception in preInvoke :
  javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: Content
  is not allowed in trailing section.   at
  org.apache.axis.handlers.HandlerChainImpl.preInvoke(HandlerChainImpl.java:188)
  at
  org.apache.axis.handlers.HandlerChainImpl.handleResponse(HandlerChainImpl.java:160)
  at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)   at
  org.apache.axis.client.Call.invokeEngine(Call.java:2765)   at
  org.apache.axis.client.Call.invoke(Call.java:2748)   at
  org.apache.axis.client.Call.invoke(Call.java:2424)   at
  org.apache.axis.client.Call.invoke(Call.java:2347)   at
  org.apache.axis.client.Call.invoke(Call.java:1804)   at
  com.mylaptop.soap.server.SimpleServerServiceBindingStub.getDesc(SimpleServerServiceBindingStub.java:103)
  at
  com.mylaptop.soap.agent.SimpleAgentService.callOperation_GETDESC(SimpleAgentService.java:75)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)   at
  sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)   at
  sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)   at
  java.lang.reflect.Method.invoke(Unknown Source)   at
  com.lansa.jsm.service.SOAPAgentService.char(Unknown Source)   at
  com.lansa.jsm.service.SOAPAgentService.for(Unknown Source)   at
  com.lansa.jsm.service.SOAPAgentService.command(Unknown Source)   at
  com.lansa.jsm.b.a(Unknown Source)   at com.lansa.jsm.b.run(Unknown
  Source)  </stackTrace>

=================================================================

HandlerChainImpl.java

    private void preInvoke ( SOAPMessageContext msgContext )
    {
        try
        {
            SOAPMessage message = msgContext.getMessage();
            // Ensure that message is already in the form we want
            if(message != null && message.getSOAPPart() != null)
                message.getSOAPPart().getEnvelope();
            msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION,
                    Boolean.FALSE);
            msgContext.setProperty(JAXRPC_METHOD_INFO, getMessageInfo(message));
        }
        catch (Exception e)
        {
            log.debug("Exception in preInvoke : ", e);

            throw new RuntimeException("Exception in preInvoke : " + e.toString());
        }
    }

=================================================================


regards

Alick Buckley

LANSA Research and Development
LANSA Pty Ltd

Phone: +61289070243

http://www.lansa.com
mailto:Alick.Buckley@lansa.com.au




Attachment: AxisServer.java
Description: Binary data

Attachment: http-content.xml
Description: Binary data

HTTP/1.1 200 OK
Date: Thu, 16 Jun 2005 05:12:25 GMT
Server: Apache/1.3.27 (Win32) ApacheJServ/1.1.2
Cache-Control: max-age=0, must-revalidate, proxy-revalidate, no-cache
Content-Length: 100
Connection: close
Content-Type: application/soap+xml; charset=utf-8

Attachment: AxisClient.java
Description: Binary data

Reply via email to