Hi All;
        I using Axis 1.1 client and I want it to accept the following SOAP
response. then it says 

  {http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXException:
Invalid element in soap.bookshop.com.ShoppingCart - CartId
at
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:261) 
org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:951).....

then what I did is add System.Out to the axis code  at
DeserializationContextImpl.startElement to find which elements give me
trouble.

Here is what I get it seem to be parsing the tags once then start from
the beging and failed at the second run. SEE line  3 and 18 has 
{}ModifyShoppingCartItemsRequestResponse But the SOAP message has only
one start element. 

1 {http://schemas.xmlsoap.org/soap/envelope/}Envelope
2 {http://schemas.xmlsoap.org/soap/envelope/}Body
3 {}ModifyShoppingCartItemsRequestResponse
4 {http://soap.bookshop.com}ShoppingCart
5 {}HMAC
6 {}purchaseUrl
7 {}CartId
8 {}Items
9 {}item0
10 {}ListPrice
11 {}OurPrice
12 {}Asin
13 {}ExchangeId
14 {}ItemId
15 {}Quantity
16 {}Catalog
17 {}ProductName
18 {}ModifyShoppingCartItemsRequestResponse
19 {http://soap.bookshop.com}ShoppingCart
20 {}HMAC
21 {}purchaseUrl
22 {}CartId

Is this mistake on my part or BUG. It has taken three days of my time
... PLEASE SOMEBODY HELP ME.

Thanks for your patience read that far,
regards 

Srinath  


SOAP MESSGAE
============

<?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><ModifyShoppingCartItemsRequestResponse>
<prf:ShoppingCart  xmlns:prf ="http://soap.bookshop.com";>
<HMAC>string0</HMAC>
<purchaseUrl>string1</purchaseUrl>
<CartId>string2</CartId>
<Items>
<item0  xsi:type="ns18:soap.bookshop.com"  xmlns:ns18 =
"urn:soap.bookshop.com"><ListPrice>string0</ListPrice>
<OurPrice>string1</OurPrice>
<Asin>string2</Asin>
<ExchangeId>string3</ExchangeId>
<ItemId>string4</ItemId>
<Quantity>string5</Quantity>
<Catalog>string6</Catalog>
<ProductName>string7</ProductName>
</item0>
</Items>
</prf:ShoppingCart>
</ModifyShoppingCartItemsRequestResponse>
</soapenv:Body>
</soapenv:Envelope>


Client Code (in case somebody need it give a idea) ( sorry for the mess
below if somebody can help I send the file as attachment)
==================================================
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;

/**
 * @author Srinath Perera([EMAIL PROTECTED])
 */
public class AmezonClient1 {
 public static void main(String[] args)throws Exception {
        String port ="5555";
        //port the TCP mon listens
        String SOAPAction ="BookShop";          //service name
                
        String endpoint = "http://127.0.0.1:"; +  port +
                "/axis/services/BookShop";
        QName method =new QName("ModifyShoppingCartItemsRequest");
                                
        soap.bookshop.com.ModifyShoppingCartItemsRequest req  = new
        soap.bookshop.com.ModifyShoppingCartItemsRequest();

   Service service = new Service();
   Call call = (Call) service.createCall();
   QName q1 = 
        new QName("http://soap.bookshop.com";, 
                "ModifyShoppingCartItemsRequest" );
    QName q2 = new QName( "http://soap.bookshop.com";, "ShoppingCart" );
    QName q3 = new QName( "http://soap.bookshop.com";, "ItemQuantity" );

call.registerTypeMapping(soap.bookshop.com.ModifyShoppingCartItemsRequest.class,       
                 q1,new org.apache.axis.encoding.ser.BeanSerializerFactory(
soap.bookshop.com.ModifyShoppingCartItemsRequest.class, q1),null);  
call.registerTypeMapping(soap.bookshop.com.ItemQuantity.class, q1,
                                                        new
org.apache.axis.encoding.ser.BeanSerializerFactory(soap.bookshop.com.ItemQuantity.class,
 q1),null);
                                
call.registerTypeMapping(soap.bookshop.com.ShoppingCart.class, q2,
                                           new
org.apache.axis.encoding.ser.BeanSerializerFactory(soap.bookshop.com.ShoppingCart.class,
 q2),
   new
org.apache.axis.encoding.ser.BeanDeserializerFactory(soap.bookshop.com.ShoppingCart.class,
 q2));

  call.setTargetEndpointAddress(new java.net.URL(endpoint));
  call.setSOAPActionURI(SOAPAction);
  call.setOperationName(method);
  call.addParameter("op1",
q1,soap.bookshop.com.ModifyShoppingCartItemsRequest.class,
ParameterMode.IN);
                           call.addParameter("op2", 
q2,soap.bookshop.com.ShoppingCart.class,
ParameterMode.OUT);
                           call.setReturnType(q2);

long st = System.currentTimeMillis();
soap.bookshop.com.ShoppingCart val = (soap.bookshop.com.ShoppingCart)
call.invoke(new Object[]{req});
long end = System.currentTimeMillis();

 System.out.println("Got result : " + val);
                           System.out.println("It takes " + (end - st) + " 
miliseconds");
        }

}


Reply via email to