Use this code to tell Apache Soap the type of "Result".
SOAPMappingRegistry smr = new SOAPMappingRegistry ();
smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("", "Result"), null, null, new
StringDeserializer());
call.setSOAPMappingRegistry (smr);
bye!
Steeve...
"Bardman, Jody" <[EMAIL PROTECTED]> on 30/07/2001 10:21:06 AM
Please respond to [EMAIL PROTECTED]
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc: (bcc: Steeve Gilbert/G_STGEORGES/CANAM_MANAC)
Subject: FW: Problem with Apache soap client accessing a MS soap server
I got it to work. Well, part of it works.
I took Pete's suggestion and kept monkeying with it.
I changed the target to this:
call.setTargetObjectURI("http://tempuri.org/message/");� Thanks Pete!
I am getting a valid response back from the MS Soap server but now my
client is now throwing an error:
faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a
':Result' using encoding style
The return value from the SOAP server is this: <Result>It works.</Result>
I am assuming my SOAP client doesn't understand "<Result>". The return is
supposed to be a string.
In the Apache sample, the SOAP XML response before <ResultList> it has
this:
<return xsi:type="xsd:string">
which I guess is informing SOAP that the return is a string.
The MS Soap server doesn't have this option that I know of.
Can I get by with a DeploymentDescriptor.xml file and where should it go?
<isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:x
="" qname="x:Result" xml2JavaClassName
="org.apache.soap.encoding.soapenc.StringDeserializer" />
Thanks for any help.
Jody
-----Original Message-----
From: Bardman, Jody
Sent: Monday, July 30, 2001 7:19 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Problem with Apache soap client accessing a MS soap server
Thanks Pete for the info but it still doesn't work.
Has anybody seen this before, "Potential typemapper problem" ?.
Jody
-----Original Message-----
From: Pete Roth [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 27, 2001 3:21 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Problem with Apache soap client accessing a MS soap server
I just had a similar problem and good for you I solved it with help from
this very helpful listserv.
The value passed to "setTargetObjectURI(String)" should be I believe the
same as the value, in the definitions section of your WSDL file that you
specified for targetNamespace.� Yours is http://tempuri.org/type as defined
in your WSDL file attached.
Second, I needed to add the namespace explicitly (for the element children
which contains the method name) to each of the argument names when creating
the method parameters.� I believe this is a bug in the .NET beta 2 we are
running.� You need to know the namesapace that the Apache libs generate
though.� In my case it was "s1".� You may have to view the XML created by
Apache once to see what it is using.
So you would change:
params.addElement(new Parameter
("JobTicket",String.class,szJobTicket,null));
to this:
params.addElement(new
Parameter("s1:JobTicket",String.class,szJobTicket,null));
Or (other than 's1') whatever the namespace declaration in your method name
element is that Apache creates.
You may or may not have to deal with that second issue remember though.� I
believe the way Apache is generating the XML is correct, it seems to be
that
Microsoft .NET server is not propagating the namespace to the children
elements.� Although I don't know very much about XML.� If anyone knows more
about this issue I would like to hear about it.
Hope this helps.� Just remember that TcpTunnelGui is your best friend.
Make
sure the Apache generated code matches the XML that the MS server requires.
(except that second issue I stated above which isn't in the Web Service
description for the method when going to your web service with a browser.
Peter Roth
Telemetry Technologies Inc.
p: 404.231.0021 ext. 1290
e: [EMAIL PROTECTED]
-----Original Message-----
From: Bardman, Jody [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 27, 2001 2:38 PM
To: '[EMAIL PROTECTED]'
Subject: Problem with Apache soap client accessing a MS soap server
Thanks for help from my last problem with the TcpTunnelGui, Gregg, Eduardo,
and Sri.
Now, the new problem:
I can't get a valid response from a MS soap server.
I know this is a big request but could somebody check my code for what I
need to add.
Thanks
Jody
Here is the request from the Apache client:
POST /TestSOAP/TestSOAP.wsdl HTTP/1.0
Host: CorePortal10
Content-Type: text/xml; charset=utf-8
Content-Length: 450
SOAPAction: "http://tempuri.org/action/SOAPService.SubmitJob"
<?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:SubmitJob xmlns:ns1="TestSOAP"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<JobTicket xsi:type="xsd:string">1234</JobTicket>
</ns1:SubmitJob>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here is the response from the MS server:
HTTP/1.1 500 Internal Server ErrorServer: Microsoft-IIS/5.0Date: Fri, 27
Jul
2001 15:10:50 GMTContent-Type: text/xml; charset="UTF-8"Content-Length:
1109Expires: -1;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>WSDLReader: None of the matching operations for soapAction
http://tempuri.org/action/SOAPService.SubmitJob could successfully load the
incoming request. Potential typemapper problem</faultstring>
<detail><mserror:errorInfo
xmlns:mserror="http://schemas.microsoft.com/soap-toolkit/faultdetail/error/
"
>
<mserror:returnCode>-2147024809</mserror:returnCode>
<mserror:callStack><mserror:callElement><mserror:component>WSDLReader</mserr
or:component><mserror:description>None of the matching operations for
soapAction http://tempuri.org/action/SOAPService.SubmitJob could
successfully load the incoming request. Potential typemapper
problem</mserror:description><mserror:returnCode>
-2147024809</mserror:return
Code>
</mserror:callElement></mserror:callStack></mserror:errorInfo></detail></SOA
P-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Here is a section of the java code:
����� URL url=new URL("http://bbrandin-ap550/TestSOAP/TestSOAP.wsdl"); //
Address of SOAP router
����� try
����� {
������� Call call=new Call();
������� call.setSOAPMappingRegistry(new SOAPMappingRegistry());
������� call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
// Question: What do I put for the setTargetObjectURI when I am trying to
access an MS Soap Server machine?
������� call.setTargetObjectURI("TestSOAP");
������� call.setMethodName("SubmitJob");
������� Vector params=new Vector();
������� String szJobTicket = "1234";
������� params.addElement(new
Parameter("JobTicket",String.class,szJobTicket,null));
������� call.setParams(params);
������� Response
resp=call.invoke(url,"http://tempuri.org/action/SOAPService.SubmitJob");
������� boolean status=resp.generatedFault();
������� if (status == true)
������� {
��������� // got a problem
����������� Fault theFault = resp.getFault();
����������� m_szDebug += " generatedFault(): ";
����������� m_szDebug += theFault.getFaultString();
������� }
������� else
������� {
����������� Parameter ret=resp.getReturnValue();
����������� m_szDebug += ret.toString();
������� }
��� }
��� catch (RuntimeException r)
��� {
����� m_szDebug += " - RuntimeException: " + r;
��� }
� }
Here is the MS wsdl file:
<?xml version="1.0" encoding="UTF-8" ?>
- <!--� Generated 05/10/01 by Microsoft SOAP Toolkit WSDL File Generator,
Version 1.00.623.1 -->
- <definitions name="TestSOAP" targetNamespace="http://tempuri.org/wsdl/"
xmlns:wsdlns="http://tempuri.org/wsdl/"
xmlns:typens="http://tempuri.org/type"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:stk="http://schemas.microsoft.com/soap-toolkit/wsdl-extension"
xmlns="http://schemas.xmlsoap.org/wsdl/">
- <types>
<schema targetNamespace="http://tempuri.org/type"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" elementFormDefault
="qualified"
/>
</types>
+ <message name="SOAPService.SubmitJob">
<part name="JobTicket" type="xsd:string" />
</message>
- <message name="SOAPService.SubmitJobResponse">
<part name="Result" type="xsd:string" />
</message>
- <portType name="SOAPServiceSoapPort">
- <operation name="SubmitJob" parameterOrder="JobTicket">
<input message="wsdlns:SOAPService.SubmitJob" />
<output message="wsdlns:SOAPService.SubmitJobResponse" />
</operation>
</portType>
- <binding name="SOAPServiceSoapBinding" type="wsdlns:SOAPServiceSoapPort">
<stk:binding preferredEncoding="UTF-8" />
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"
/>
- <operation name="SubmitJob">
<soap:operation soapAction="http://tempuri.org/action/SOAPService.SubmitJob
"
/>
- <input>
<soap:body use="encoded" namespace="http://tempuri.org/message/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
- <output>
<soap:body use="encoded" namespace="http://tempuri.org/message/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
- <service name="TestSOAP">
+ <port name="SOAPServiceSoapPort" binding="wsdlns:SOAPServiceSoapBinding">
<soap:address location="http://bbrandin-ap550/TestSOAP/TestSOAP.WSDL" />
</port>
</service>
</definitions>