Axis generates RPC/encoded by default unless you tell it otherwise. It
doesn't check the WSDL at runtime, so it relies on you to specify the
proper settings.

If you use wsdl2java, the generated client stub will have all the
proper settings, but because you are using the Call interface, you
must programmatically set the OPERATION_STYLE_PROPERTY and the
ENCODING_STYLE_PROPERTY.

Anne

On Mon, Apr 28, 2008 at 10:06 AM, Erik Wheeler <[EMAIL PROTECTED]> wrote:
> Hello all:
>
>  I'm trying to use a web service, but getting errors because Axis is
>  formatting the request with a multiRef.
>
>  The request is going out on the wire as:
>
>  <?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:GetBusiness
>  soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>  xmlns:ns1="http://tempuri.org/SatuitWebService/SatuitCRM_XML_API";>
>                         <ns1:strUID
>  xsi:type="xsd:string">user</ns1:strUID>
>                         <ns1:strPWD
>  xsi:type="xsd:string">password</ns1:strPWD>
>                         <ns1:Ibuskey href="#id0"/>
>                 </ns1:GetBusiness>
>                 <multiRef id="id0" soapenc:root="0"
>  soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>  xsi:type="xsd:int"
>  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>44548</multiRe
>  f>
>         </soapenv:Body>
>  </soapenv:Envelope>
>
>
>  This fails with:
>
>  System.Web.Services.Protocols.SoapException: Server was unable to read
>  request. ---> System.InvalidOperationException: There is an error in XML
>  document (1, 514). ---> System.FormatException: Input string was not in
>  a correct format.
>
>  However, when I format the request manually without the multiRef and
>  submit (on the command line with 'wget') it works. In other words, it
>  works when the "Ibuskey" value above is instead like this:
>
>   <ns1:Ibuskey xsi:type="xsd:int">44548</ns1:Ibuskey>
>
>
>  The WSDL is at:
>  https://www2.satuitcrm.com/dwight/satuitcrm_XML_api.asmx?WSDL
>
>
>
>  I'm assuming that this is an issue of service style. But shouldn't it
>  use the style attribute from the "GetBusiness" operation? It starts
>  with:
>
>   <wsdl:operation name="GetBusiness">
>   <soap:operation
>  soapAction="http://tempuri.org/SatuitWebService/SatuitCRM_XML_API/GetBus
>  iness" style="document"/>
>
>
>  Here's my test code:
>
>  import org.apache.axis.client.Call;
>  import org.apache.axis.client.Service;
>  import javax.xml.rpc.ParameterMode;
>
>  public class TestClient {
>   public static void main(String[] args) {
>         try {
>                 String endpoint =
>  "https://www2.satuitcrm.com/dwight/satuitcrm_XML_api.asmx";;
>                 String methodName = "GetBusiness";
>                 String namespace =
>  "http://tempuri.org/SatuitWebService/SatuitCRM_XML_API";;
>
>                 Service service = new Service();
>                 Call call = (Call) service.createCall();
>
>                 call.setTargetEndpointAddress(new
>  java.net.URL(endpoint));
>
>                 call.setOperationName(new
>  javax.xml.namespace.QName(namespace, methodName));
>
>
>  call.setSOAPActionURI("http://tempuri.org/SatuitWebService/SatuitCRM_XML
>  _API/GetBusiness");
>
>         call.addParameter(new javax.xml.namespace.QName(namespace,
>  "strUID"),
>         new
>  javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema";, "string"),
>  ParameterMode.IN);
>
>         call.addParameter(new javax.xml.namespace.QName(namespace,
>  "strPWD"),
>         new
>  javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema";, "string"),
>  ParameterMode.IN);
>
>         call.addParameter(new javax.xml.namespace.QName(namespace,
>  "Ibuskey"),
>         new
>  javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema";, "int"),
>  ParameterMode.IN);
>
>         call.setReturnType(new javax.xml.namespace.QName(namespace,
>  "GetBusinessResult"), java.lang.String.class);
>
>         System.out.println(call.toString());
>         String ret = (String) call.invoke(new Object[] { "user",
>                                         "password" , (new
>  Integer(44548)) });
>
>                         System.out.println(ret);
>                 } catch (Exception e) {
>                         System.err.println(e.toString());
>                 }
>         }
>  }
>
>
>  Thanks for any suggestions you may have.
>
>  Regards,
>
>  Erik Wheeler
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to