right, i can test it, but how do you specify that you send a doc/literal request ??
shall i change the strange parameter : Constants.NS_URI_SOAP_ENC to something else ??
Simon Fell <[EMAIL PROTECTED]>
02/22/2002 05:53 PM
|
To: [EMAIL PROTECTED] cc: Subject: Re: java client for .NET - what do i ignore ? |
That correct for calling MS Toolkit 2.0 services, but not for .NET.
.NET by default does doc/literal SOAP, not rpc/encoded, you're sending
an rpc/encoded message, which .NET will largely ignore. You need to
send a doc/literal request. Not sure how you cook those up with the
2.2 code.
Cheers
Simon
www.pocketsoap.com
On Fri, 22 Feb 2002 10:35:36 -0600, in soap you wrote:
>
>//ADD YOUR OWN DESERIALIZER SINCE THIS IS CALLING A MS SERVER THERE IS
> //NO xsi:type attribute returned....
> //Create a new SoapMappingRegistry
>SOAPMappingRegistry smr = new SOAPMappingRegistry();
>
>//Assuming that your return is a string
>StringDeserializer ds = new StringDeserializer();
>
>//Map the datatype to the name provided..
> smr.mapTypes(Constants.NS_URI_SOAP_ENC,new QName("","BonjourResult
>"),null,null,ds);
>
> //Set the mapping to the call object
> call.setSOAPMappingRegistry(smr);
>
>hth
>Doug
>
>
>
> Elise_Dupont@lion
> bridge.com To: [EMAIL PROTECTED]
> cc: (bcc: Doug Swanson/US-Corporate/3M/US)
> 02/22/2002 10:24 Subject: Re: java client for .NET - what do i ignore ?
> AM
> Please respond to
> soap-dev
>
>
>
>
>
>
>
>(i must specify that i read the SOAP documentation about xsi:type problem,
>adapted my code to this problem and had no more results....)
>the guiden sample didn't help me, and i still have an error when
>retrieving the String from .NET webservice
>
>
>
>"Caught SOAPException (SOAP-ENV:Client): No Deserializer found to
>deserialize a 'http://tempuri.org/:BonjourResult' using encoding style
>'http://schemas.xmlsoap.org/soap/encoding/'."
>
>
>
>
>
>
>
>
>[EMAIL PROTECTED]
>02/22/2002 11:54 AM
>Please respond to soap-dev
>
>
> To: [EMAIL PROTECTED]
> cc:
> Subject: java client for .NET - what do i ignore ?
>
>
>
>
>hi,
>i'm still making connection tests from my java client to my .NET
>webservice.
>
>i looked at the samples some of you gave me(Scott Nichol with
>samples/interop subdirectory of your Apache SOAP
>installation) , and other one, the aim was to make a Call() to my .NET
>webservice.
>I also used a sniffer to look at the soap envelope i'm sending.
>First of all, the .NET webservice is expecting SOAP data A (see enclosed
>code) but my java client is sending SOAP data B with java client code C,
>and as the webservice should return "hello [theString i sent], the result
>is simply :
>
>"EndpointURL: http://biztalk:8080/PCS_Integration/SynchronizeProfiles.asmx
>Calling EchoString...
>EchoByte called with: [B@171afc
>EchoByte Result: Hello"
>
>
>
>And then i get this error if i use the code D in my java client :
>
>"Caught SOAPException (SOAP-ENV:Client): No Deserializer found to
>deserialize a 'http://tempuri.org/:BonjourResult' using encoding style
>'http://schemas.xmlsoap.org/soap/encoding/'."
>
>
>
>what's wrong ? why can't i still have a correct working connection with a
>correct understandable data ? Any code i test doesn't fully work...
>
>any help would be appreciated, as this is just a test part, and i will
>have to send a complex data later... I'll never see the end ;)
>Elise
>
>
>==================================================
>code A : what is expecting .NET
>
>POST /PCS_Integration/SynchronizeProfiles.asmx HTTP/1.1
>Host: biztalk
>Content-Type: text/xml; charset=utf-8
>Content-Length: length
>SOAPAction: "http://tempuri.org/Bonjour"
>
><?xml version="1.0" encoding="utf-8"?>
><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="
>http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <Bonjour xmlns="http://tempuri.org/">
> <strName>string</strName>
> </Bonjour>
> </soap:Body>
></soap:Envelope>
>
>
>=======================================================
>code B : what is sending my java client
>
><?xml version="1.0" encoding="UTF-8" ?>
>- <SOAP-ENV:Envelope xmlns:SOAP-ENV="
>http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="
>http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="
>http://www.w3.org/1999/XMLSchema">
>- <SOAP-ENV:Body>
>- <ns1:Bonjour xmlns:ns1="http://tempuri.org/" SOAP-ENV:encodingStyle="
>http://schemas.xmlsoap.org/soap/encoding/">
> <strName xsi:type="xsd:string">my string</strName>
> </ns1:Bonjour>
> </SOAP-ENV:Body>
></SOAP-ENV:Envelope>
>
>
>================================================================
>Code C : the corresponding java code
>
>
> URL url = new URL ("
>http://biztalk:8080/PCS_Integration/SynchronizeProfiles.asmx");
>
> SOAPMappingRegistry smr = new SOAPMappingRegistry ();
> StringDeserializer sd = new StringDeserializer ();
> smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("",
>"Result"), null, null, sd);
>
> // create the transport and set parameters
> SOAPHTTPConnection st = new SOAPHTTPConnection();
>
> // build the call.
> Call call = new Call ();
> call.setSOAPTransport(st);
> call.setSOAPMappingRegistry (smr);
>
> call.setTargetObjectURI ("http://tempuri.org/");
> call.setMethodName("Bonjour");
> call.setEncodingStyleURI (Constants.NS_URI_SOAP_ENC);
>
> Vector params = new Vector();
>
> params.addElement(new Parameter("strName", String.class,
>"my string", null));
> call.setParams(params);
>
> Response resp = null;
> try {
> resp = call.invoke (url, "http://tempuri.org/Bonjour");
> }
> catch (SOAPException e) {
> System.err.println("Caught SOAPException (" +
>e.getFaultCode () + "): " + e.getMessage ());
> return;
> }
>
> // check response
> if (resp != null && !resp.generatedFault()) {
> Parameter ret = resp.getReturnValue();
> Object value = ret.getValue();
>
> System.out.println ("Answer--> " + value);
> }
> else {
> Fault fault = resp.getFault ();
> System.err.println ("Generated fault: ");
> System.out.println (" Fault Code = " +
>fault.getFaultCode());
> System.out.println (" Fault String = " +
>fault.getFaultString());
> }
>
>
>
>
>
>================================================================
>code D : The java code that returns me the SOAPException (SOAP-ENV:Client)
>
> String sEndpointURL = "
>http://biztalk:8080/PCS_Integration/SynchronizeProfiles.asmx";
> System.out.println("EndpointURL: " + sEndpointURL);
> SynchronizeProfilesProxy profileProxy = new
>SynchronizeProfilesProxy(sEndpointURL);
>
> String theString = "This is a string";
> System.out.println("\nCalling EchoString...");
> System.out.println("EchoByte called with: " + request);
> System.out.println("EchoByte Result: " +
>profileProxy.EchoByte(request));
>
> // This Method uses the "RPC" style of call, and corresponding
>Apache 2.2
> // classes to do so.
> public synchronized String EchoByte (byte[] theByte)
> throws SOAPException
> {
> if (_url == null)
> {
> throw new
>SOAPException(org.apache.soap.Constants.FAULT_CODE_CLIENT,
> "A URL must be specified via setEndPoint(URL).");
> }
>
> // Map the types.
> SOAPMappingRegistry smr = new SOAPMappingRegistry();
> StringDeserializer ser = new StringDeserializer ();
> smr.mapTypes (Constants.NS_URI_SOAP_ENC,null,
>String.class, null, ser);
> _call.setSOAPMappingRegistry(smr);
> _call.setMethodName("Bonjour");
> _call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
> Vector params = new Vector();
> Parameter pTheByte = new Parameter("strName",
>String.class, "my string", null);
> params.addElement(pTheByte);
> _call.setParams(params);
> Response resp = _call.invoke(_url, METHOD_NAMESPACE +
>"Bonjour");
>
> // Check the response.
> if (resp.generatedFault())
> {
> Fault fault = resp.getFault();
> throw new SOAPException(fault.getFaultCode(),
>fault.getFaultString());
> }
> else
> {
> Parameter retValue = resp.getReturnValue();
> String theResult = (String)retValue.getValue();
> return theResult;
> }
> }
>
>
>
>
><< File att1.htm not included with reply >>
>
>
>