You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "AS-IT-3-9-20 Loesche, Mathias" <as...@auswaertiges-amt.de> on 2006/11/09 13:16:36 UTC

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected

Hello,

I've a strange problem using wss4j 1.5.0 with axis 1.4.

During the parsing of the ready encoded soap xml Document the following 
exception occured

2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.enterprise: Mapping Exception to AxisFault
org.xml.sax.SAXException: SimpleDeserializer encountered a child 
element, which is NOT expected, in something it was trying to deserialize.
    at 
org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)

The soap request is (from the SOAP Mointor)

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <wsse:Security soapenv:mustUnderstand="1" 
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <xenc:EncryptedKey Id="EncKeyId-534353">
        <xenc:EncryptionMethod 
Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
        <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
          <wsse:SecurityTokenReference>
            <wsse:KeyIdentifier 
EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" 
ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3">MIIDljCCAv+gAwIBAgIJALveiiZKbS80MA0GCSqGSIb3DQEBBAUAMIGPMQswCQYDVQQGEwJERTEPMA0GA1UECBMGQmVybGluMQ8wDQYDVQQHEwZCZXJsaW4xCzAJBgNVBAoTAkF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2RSN5GR6R/mmE3Vrf0CUzGMCE/H3UchlAA==</wsse:KeyIdentifier>
          </wsse:SecurityTokenReference>
        </ds:KeyInfo>
        <xenc:CipherData>
          
<xenc:CipherValue>Y0iN+MlvPFgUm8IWx8qThEkReBOEENXAbuNvQv5OVZ4ejm5VQasFaRxk3ZJXAF0uJqdm1ZKKPJlMZU2MiUnxpg50b04nolTHLM24gzZlXrY8ttoSG8wblxnnzkv4mvC7+LNoafJM6rJBckx7As60xr3dLF6cOunzSOK61GG6DMs=</xenc:CipherValue>
        </xenc:CipherData>
        <xenc:ReferenceList>
          <xenc:DataReference URI="#EncDataId-29594051"/>
        </xenc:ReferenceList>
      </xenc:EncryptedKey>
    </wsse:Security>
  </soapenv:Header>
  <soapenv:Body>
    <ns1:hallo 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="http://aa">
      <name xsi:type="xsd:string">blablabla</name>
    </ns1:hallo>
  </soapenv:Body>
</soapenv:Envelope>


generated with the following Client:

import org.apache.xml.utils.*;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

public class cl_HelloWorld
{
   public static void main(String [] args) {
       try {

           Options options = new Options(args);

           String endpointURL =
                    "http://127.0.0.1:8080/axis/services/HelloWorldXmlEnc";

           String textToSend;

            args = options.getRemainingArgs();
            if ((args == null) || (args.length < 1)) {
                textToSend = "<nothing>";
            } else {
                textToSend = args[0];
            }

            Service  service = new Service();
            Call     call    = (Call) service.createCall();

            call.setTargetEndpointAddress( new java.net.URL(endpointURL) );
            call.setOperationName( new QName("http://aa", "hallo") );
            call.addParameter( "name", 
org.apache.axis.Constants.XSD_STRING, ParameterMode.IN);
            call.setReturnType(org.apache.axis.Constants.XSD_STRING);

            String ret = (String) call.invoke( new Object[] { textToSend 
} );


           System.out.println( ret );
       } catch (Exception e) {
           System.err.println(e.toString());
       }
   }
}


The encryption and decryption works fine as I can see in the log. The I 
can find the encrypted and later the decrypted soapbody.

When I call a plain service, the generated soap request is:

<?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:hallo 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="http://aa">
      <name xsi:type="xsd:string">test</name>
    </ns1:hallo>
  </soapenv:Body>
</soapenv:Envelope>

All works fine. I use the same client, except the URL of the service of 
cause.

Here the last messages before the exception occured
8080-Processor25] org.apache.axis.providers.java.RPCProvider: body is 
<ns1:hallo 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="http://aa" 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><name 
xsi:type="xsd:string" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">blablabla</name></ns1:hallo>
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.i18n.ProjectResourceBundle: 
org.apache.axis.i18n.resource::handleGetObject(pushHandler00)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.encoding.DeserializationContext: Pushing handler 
org.apache.axis.message.RPCHandler@1854b38
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.encoding.DeserializationContext: Enter: 
DeserializationContext::startPrefixMapping(ns1, http://aa)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.utils.NSStack: NSPush (32)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.utils.NSStack: NSPush (32)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.encoding.DeserializationContext: Exit: 
DeserializationContext::startPrefixMapping()
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.encoding.DeserializationContext: Enter: 
DeserializationContext::startElement(http://aa, hallo)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.message.RPCHandler: Enter: RPCHandler.onStartChild()
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.i18n.ProjectResourceBundle: 
org.apache.axis.i18n.resource::handleGetObject(typeFromAttr00)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.message.RPCHandler: Type from attributes is:  null
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.message.RPCHandler: Exit: RPCHandler.onStartChild()
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.i18n.ProjectResourceBundle: 
org.apache.axis.i18n.resource::handleGetObject(pushHandler00)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.encoding.DeserializationContext: Pushing handler 
org.apache.axis.encoding.ser.SimpleDeserializer@d81b4
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.encoding.DeserializationContext: Exit: 
DeserializationContext::startElement()
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.encoding.DeserializationContext: Enter: 
DeserializationContext::startElement(, name)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.i18n.ProjectResourceBundle: 
org.apache.axis.i18n.resource::handleGetObject(cantHandle00)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.i18n.ProjectResourceBundle: 
org.apache.axis.i18n.resource::handleGetObject(toAxisFault00)
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.enterprise: Mapping Exception to AxisFault
org.xml.sax.SAXException: SimpleDeserializer encountered a child 
element, which is NOT expected, in something it was trying to deserialize.

Following logs are strange in my eyes:
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.message.RPCHandler: Type from attributes is:  null
2006-11-09 12:03:16,029 DEBUG [http-8080-Processor25] 
org.apache.axis.encoding.DeserializationContext: Enter: 
DeserializationContext::startElement(, name)

All runs with jdk1.5.0-09.

I tried for days to get any idea what could be wrong, but unfortunately 
without any progress.
Does anyone have any  idea, what or where could be the problem or where 
to debug next?
It would me make very,very glad.


Thanks a lot !

Mathias



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected

Posted by "AS-IT-3-9-20 Loesche, Mathias" <as...@auswaertiges-amt.de>.
Hello,

as I've read in other posts there resson can be a false wsdd file which 
does not match to the gotten soap xml. I've generated the wsdl with the 
axis Admin client with the following wsdd file


<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">

<service name="HelloWorldXmlEnc" provider="java:RPC" style="document" 
use="literal">
<requestFlow>
<handler type="java:org.apache.ws.axis.security.WSDoAllReceiver">
<parameter name="passwordCallbackClass" value="aa.ePWCallback"/>
<parameter name="action" value="Encrypt" />
<parameter name="decryptionPropFile" value="server.crypto.properties" />
</handler>
<handler type="soapmonitor"/>
</requestFlow>
<responseFlow>
<handler type="soapmonitor"/>
</responseFlow>
<parameter name="className" value="aa.HelloWorld"/>
<parameter name="allowedMethods" value="*"/>
</service>

</deployment>

using the command line
java -classpath $AXISCLASSPATH org.apache.axis.client.AdminClient -l 
http://127.0.0.1:8080/axis/servlet/AxisServlet deploy_service.wsdd

That generates the following wsdl:

<wsdl:definitions 
targetNamespace="http://localhost:8080/axis/services/HelloWorldXmlEnc">
−
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
−
<wsdl:types>
−
<schema elementFormDefault="qualified" targetNamespace="http://aa">
<element name="in0" type="xsd:string"/>
</schema>
−
<schema elementFormDefault="qualified" 
targetNamespace="http://localhost:8080/axis/services/HelloWorldXmlEnc">
<element name="halloReturn" type="xsd:string"/>
</schema>
</wsdl:types>
−
<wsdl:message name="halloResponse">
<wsdl:part element="impl:halloReturn" name="halloReturn"/>
</wsdl:message>
−
<wsdl:message name="halloRequest">
<wsdl:part element="tns1:in0" name="in0"/>
</wsdl:message>
−
<wsdl:portType name="HelloWorld">
−
<wsdl:operation name="hallo" parameterOrder="in0">
<wsdl:input message="impl:halloRequest" name="halloRequest"/>
<wsdl:output message="impl:halloResponse" name="halloResponse"/>
</wsdl:operation>
</wsdl:portType>
−
<wsdl:binding name="HelloWorldXmlEncSoapBinding" type="impl:HelloWorld">
<wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
−
<wsdl:operation name="hallo">
<wsdlsoap:operation soapAction=""/>
−
<wsdl:input name="halloRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
−
<wsdl:output name="halloResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
<wsdl:service name="HelloWorldService">
−
<wsdl:port binding="impl:HelloWorldXmlEncSoapBinding" 
name="HelloWorldXmlEnc">
<wsdlsoap:address 
location="http://localhost:8080/axis/services/HelloWorldXmlEnc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Please, if anybody as an idea where to look respond .

Regards
Mathias


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org