You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Gregory M. Baumgardner (JIRA)" <ax...@ws.apache.org> on 2005/08/09 16:33:36 UTC

[jira] Commented: (AXIS-2149) Found instance data for Header in the soap:body instead of the soap:header for valid looking XML

    [ http://issues.apache.org/jira/browse/AXIS-2149?page=comments#action_12318160 ] 

Gregory M. Baumgardner commented on AXIS-2149:
----------------------------------------------

Kristian,

I am glad you wrote this up.  I just ran into the exact same problem on our system, only my exception is being thrown by the client, when it receives the response.

My WSDL message:
    <wsdl:message name="ReportDefinitionImportResponse">
        <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">The report definition import response details the status of the import operation</wsdl:documentation>
        <wsdl:part element="types:OperationStatus" name="status">
            <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Status message for the operation</wsdl:documentation>
        </wsdl:part>
    </wsdl:message>

The SOAP binding:

            <wsdl:output>
                <soap:header
                    message="art:ReportDefinitionImportResponse"
                    part="status"
                    use="literal"> </soap:header>
            </wsdl:output>

Note that there should be no body, just like in your example.  However, just like in your example, Axis is generating some useless empty part in the body that is not correct:

<?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:Header>
         <ns1:OperationStatus operation="rdImport" success="true" xmlns:ns1="http://xml.nos.lucent.com/vitalsuite/art/types/"/>
      </soapenv:Header>
      <soapenv:Body>
         <ReportImportResponse xmlns="http://xml.nos.lucent.com/vitalsuite/art/report/types/"/>
      </soapenv:Body>
   </soapenv:Envelope>

After debugging the issue, RPCHandler, line 204 is failing the tests:

            // Make sure that we don't find body parameters that should
            // be in the header
            if (!isHeaderElement &&
                ((isResponse && paramDesc.isOutHeader()) ||
                 (!isResponse && paramDesc.isInHeader()))) {
                throw new SAXException(
                    Messages.getMessage("expectedHeaderParam", 
                                        paramDesc.getQName().toString()));
            }

This was because the parameter being checked was the bogus ReportImportResponse in the body, not the correct OperationStatus in the header.  Thus, since Axis thinks the response was in the body, it throws the exception.  It never processed the header in my case.  I assume that if we can get Axis to stop building these bogus body elements, then it might work.  Any ideas?


> Found instance data for Header in the soap:body instead of the soap:header for valid looking XML
> ------------------------------------------------------------------------------------------------
>
>          Key: AXIS-2149
>          URL: http://issues.apache.org/jira/browse/AXIS-2149
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2.1
>  Environment: Windows XP
> Sun JDK 1.4.2
> JBoss 3.2.x
>     Reporter: Kristian Andersen

>
> In a soc/literal webservice I receive a org.xml.sax.SAXException: Found instance data for {http://my.namespace.com}Header in the soap:body instead of the soap:header when calling an operation that has a soap:header message defined, but no soap:body messages.
> I have written the WSDL as it is described below, unfortunateley I am unable to attach the actual WSDL. I am using WSDL2java to
> genereate both client and serverside code. When running, the client generates XML as described below and the server responds with a org.xml.sax.SAXException: Found instance data for {http://my.namespace.com}Header in the soap:body instead of the soap:header
> Description of WSDL:
> ------8<----------
>  
> <wsdl:message name="MethodRequest">
> <wsdl:part name="Header" element="namespace:Header"/>
> </wsdl:message>
> <wsdl:message name="MethodResponse">
> <wsdl:part name="MethodResponse" element="namespace:MethodResponse"/>
> </wsdl:message>
> <wsdl:message name="MethodFault">
> <wsdl:part name="MethodFault" element="namespace:MethodFault""/>
> </wsdl:message>
> ------8<----------
> <wsdl:operation name="Method">
> <wsdl:input name="MethodRequest" message="tns:MethodRequest"/>
> <wsdl:output name="MethodResponse" message="tns:MethodResponse"/>
> <wsdl:fault name="MethodFault" message="tns:MethodFault"/>
> </wsdl:operation>
> ------8<----------
> <wsdl:operation name="Method">
> <wsdlsoap:operation style="document" soapAction="Method"/>
> <wsdl:input>
> <wsdlsoap:header part="Header" use="literal"/>
> <wsdlsoap:body use="literal"/>
> </wsdl:input>
> <wsdl:output>
> <wsdlsoap:body use="literal"/>
> </wsdl:output>
> <wsdl:fault name="MethodFault">
> <wsdlsoap:fault name="MethodFault" use="literal"/>
> </wsdl:fault>
> </wsdl:operation>
> ------8<----------
> Resulting XML message:
> <?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:Header>
> <namespace:Header xmlns:namespace="http://my.namespace.com">
> <!--Header data goes her, it is looking OK-->
> </namespace:Header>
> </soapenv:Header>
> <soapenv:Body>
> <Method xmlns=""/>
> </soapenv:Body>
> </soapenv:Envelope>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira