Title: Axis client to .NET server problems

Hi,

I have created a client using AXIS to talk to a .NET service.... however, I always this error:
-------------
http://xml.apache.org/axis/}stackTrace: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:148)
        at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1001)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:159)
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1050)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:196)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:310)
        at org.apache.axis.client.Call.invoke(Call.java:2381)
        at org.apache.axis.client.Call.invoke(Call.java:2280)
        at org.apache.axis.client.Call.invoke(Call.java:1741)
        at com.kargo.verizon.soap.VerizonBillingSoapModule.isUserEntitled(VerizonBillingSoapModule.java:116)
        at com.kargo.verizon.soap.VerizonBillingSoapModule.main(VerizonBillingSoapModule.java:170)

---------------------
Here is the WDSL snippet of the .NET service i want to call:

<s:schema elementFormDefault="qualified" targetNamespace="http://www.company.com/Partners/">
      <s:element name="IsUserEntitled">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="PartnerIdentity" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="PartnerEvidence" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="UserIdentity" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="UserEvidence" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="ProductID" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="ProductVersion" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
</s:schema>

--------------------
my axis client is sending this request to that service:

POST /PartnerServices/PartnerServiceLocator.asmx?WSDL HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2beta
Host: 209.11.32.229:7071
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "http://www.company.com/Partners/IsUserEntitled"
Content-Length: 754
Authorization: Basic S2FyZ29ASU5TUFBhcnRuZXIuY29tOjl0NC5TZ3lYSzA=

<?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>
  <IsUserEntitled xmlns="http://www.InfoSpace.com/Partners/">
   <PartnerIdentity xmlns="">[EMAIL PROTECTED]</PartnerIdentity>
   <PartnerEvidence xmlns="">09242004123247610:YTM2MzUyYjQ4ZDFhNTA1NjMwZTliMThiMzBjNWQ5NWI=</PartnerEvidence>
   <UserIdentity xmlns="">166.154.xxx.xxxx</UserIdentity>
   <UserEvidence xmlns="">05609EEFA140D10CAC</UserEvidence>
   <ProductID xmlns="">800002</ProductID>
   <ProductVersion xmlns="">1.0</ProductVersion>
  </IsUserEntitled>
 </soapenv:Body>
---------------------------
i believe the problem is that all the parameters are specifying "xmlns="" " and the .NET service is asking for qualified namespaces... i believe the solution is to try and remove the xmlns="" from the parameters like so:

<?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>
  <IsUserEntitled xmlns="http://www.InfoSpace.com/Partners/">
   <PartnerIdentity>[EMAIL PROTECTED]</PartnerIdentity>
   <PartnerEvidence>09242004123247610:YTM2MzUyYjQ4ZDFhNTA1NjMwZTliMThiMzBjNWQ5NWI=</PartnerEvidence>
   <UserIdentity>166.154.160.251</UserIdentity>
   <UserEvidence>[EMAIL PROTECTED]</UserEvidence>
   <ProductID>800002</ProductID>
   <ProductVersion>1.0</ProductVersion>
  </IsUserEntitled>
 </soapenv:Body>
-----------------------
however, in the various ways i have set up my axis client, i can't get the request to be formatted in this way.  i am fairly new to using axis, so i may not be configuring it correctly to do what i want it to do... here is the code snippet:
       
           Service service = new Service();
            Call call = (Call) service.createCall();

            // Set username/password
            call.setUsername(_partnerId);
            call.setPassword(_password);

            // Set the target service to send to
            System.setProperty("java.protocol.handler.pkgs",
                    "com.sun.net.ssl.internal.www.protocol");
            Security.addProvider(new Provider());
            URL targetUrl = new URL(_targetEndpoint2);

            call.setTargetEndpointAddress(targetUrl);

            call.setOperationName(new QName(
                    "http://www.company.com/Partners/", "IsUserEntitled"));
            call.setOperationStyle("rpc");
            call.setOperationUse("literal");

            // Map the parameter names to the soap method
            call.addParameter("PartnerIdentity", XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.addParameter("PartnerEvidence", XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.addParameter("UserIdentity", XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.addParameter("UserEvidence", XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.addParameter("ProductID", XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.addParameter("ProductVersion", XMLType.XSD_STRING,
                    ParameterMode.IN);
            call.setReturnType(XMLType.XSD_STRING);           
            call.setProperty(Call.SOAPACTION_USE_PROPERTY, new Boolean(true));
            call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://www.company.com/Partners/IsUserEntitled");

            // Invoke the soap call here calling this object method
            System.out.println("Invoking call....");      
        (String) call.invoke(new Object[] { _partnerId,
                    _partnerEvidence, userId, userEvidence, productId,
                    productVersion });

---------------
any suggestion as to what i am doing wrong?  any help would be appreciated...

thanks,
peter

Reply via email to