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 "Pasula, Venugopal (Consultant)" <Ve...@GTECH.COM> on 2005/08/18 16:52:49 UTC

SAX Exception while deserialzing the soap request.

Hi,
   I am getting the following SAXException while deserializing the SOAP request.The weired thing is, it is working fine when I create stubs in the client side and access thru those stubs.

            ConnectInteractiveWebServiceServiceLocator serv = new ConnectInteractiveWebServiceServiceLocator();
            ConnectInteractiveWebService port = serv.getConnectInteractiveWebServicePort();
            return port.execute(functionName, req);

  But when I use the axis API directly without creating the stubs, then I am getting the SAX exception. Here is the code I have written. The same code is working fine in all the machines. I am getting the problem on couple of machines. I want know why this problem is appearing only those machines. we are using axis 1.2RC2 on both client and server. I attached the error statck trace at the bottom. please find it. this is the code I am using to invoke webservice with out creating the stubs.Can you please tell me where I am doing wrong?? I really appreciate your response.

    	Object[] arg = new Object[2];
    	Service serv = new org.apache.axis.client.Service();
    	TypeMappingRegistry tmr = serv.getTypeMappingRegistry();
    	TypeMapping tm = tmr.getDefaultTypeMapping();
    	tm.register(NameValuePair[].class,new QName("http://service.escb2b.gtech.com", "ArrayoffNameValuePair"),
    			new org.apache.axis.encoding.ser.ArraySerializerFactory(),
    			new org.apache.axis.encoding.ser.ArrayDeserializerFactory());
    	tm.register(NameValuePair.class, new QName("http://service.escb2b.gtech.com", "NameValuePair"),
    			new org.apache.axis.encoding.ser.BeanSerializerFactory(NameValuePair.class,new QName			           ("http://service.escb2b.gtech.com", "NameValuePair")),
    			new org.apache.axis.encoding.ser.BeanDeserializerFactory(NameValuePair.class,new QName                         	           ("http://service.escb2b.gtech.com", "NameValuePair")));

    	NameValuePair[] nvpReq = fromMap(req);
    	arg[0]="execute";
    	arg[1]=nvpReq;

    	String operationResponse = "executeResponse";
    	String operationReturn = "executeReturn";
    	RPCElement rpc = new org.apache.axis.message.RPCElement("http://service.escb2b.gtech.com", "execute", arg);
    	SOAPEnvelope env = new org.apache.axis.message.SOAPEnvelope();
    	MessageContext msgctx = new org.apache.axis.MessageContext(new org.apache.axis.client.AxisClient());

    	msgctx.setTypeMappingRegistry((org.apache.axis.encoding.TypeMappingRegistry)tmr);
    	Call cal = serv.createCall(new QName("ConnectInteractiveWebServicePort"), new QName("execute"));
        cal.setTargetEndpointAddress(endpoint);
    	cal.setReturnType(new QName("http://service.escb2b.gtech.com", "ArrayofNameValuePair"));
    	env.addBodyElement(rpc);
    	SOAPEnvelope resp = ((org.apache.axis.client.Call)cal).invoke(env);
    	RPCElement rpcelm = (org.apache.axis.message.RPCElement)resp.getBodyByName 	                    ("http://service.escb2b.gtech.com",operationResponse);
    	RPCParam rpcparam =  rpcelm.getParam(operationReturn);
    	NameValuePair[] result = (NameValuePair[])rpcparam.getObjectValue();


Thanks, Venu

=================================  ERROR MESSAGE  =========================================================

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXException: Invalid element in com.gtech.escb2b.service.NameValuePair - item
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}hostname:XXSI38

org.xml.sax.SAXException: Invalid element in com.gtech.escb2b.service.NameValuePair - item
	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1083)
	at org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:546)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:533)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1535)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:348)
	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:539)
	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:595)
	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1125)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:226)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:645)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
	at lux.gtech.h2b.handler.ResponseHandler.invoke(ResponseHandler.java:84)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:160)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
	at org.apache.axis.client.Call.invoke(Call.java:2702)
	at org.apache.axis.client.Call.invoke(Call.java:1856)
	at lux.gtech.h2b.service.H2BRequestProcessor.makeASOAPRequest(H2BRequestProcessor.java:109)

-----------------------------------------
This email may contain confidential and privileged material for the
sole use of the intended recipient(s). Any review, use, retention,
distribution or disclosure by others is strictly prohibited. If you are
not the intended recipient (or authorized to receive for the
recipient), please contact the sender by reply email and delete all
copies of this message. Also, email is susceptible to data corruption,
interception, tampering, unauthorized amendment and viruses. We only
send and receive emails on the basis that we are not liable for any
such corruption, interception, tampering, amendment or viruses or any
consequence thereof.