C# accessing Java Apache SOAP

R

Ravi Shankar

Dear all,

I have a C# program which is trying to retrieve value from Apache SOAP. I
want it get it done before moving to Axix.Here is the program:

// HelloWorld.cs


using System.Diagnostics;

using System.Xml.Serialization;

using System;

using System.Web.Services.Protocols;

using System.Web.Services;


[System.Web.Services.WebServiceBindingAttribute(

Name="Example1Soap",

Namespace="urn:xmltoday-delayed-quotes")]

public class Example1 :

System.Web.Services.Protocols.SoapHttpClientProtocol {


public Example1( ) {

this.Url = "http://localhost:8070/soap/servlet/rpcrouter";

}


[System.Web.Services.Protocols.SoapDocumentMethodAttribute(

"urn:xmltoday-delayed-quotes/getQuote",

RequestNamespace="urn:xmltoday-delayed-quotes",

ResponseNamespace="urn:xmltoday-delayed-quotes",

Use=System.Web.Services.Description.SoapBindingUse.Encoded,

ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

public string getQuote(string name) {

object[] results = this.Invoke("getQuote",

new object[] {name});

return ((string)(results[0]));

}


public static void Main() {

Console.WriteLine("Calling the SOAP Server to get Quote");

Example1 example1 = new Example1();

Console.WriteLine("The SOAP Server says: " +

example1.getQuote("IBM"));

}

}

It connects perfectly, and TunnelGUI shows response as:

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<ns1:getQuoteResponse xmlns:ns1="urn:xmltoday-delayed-quotes"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<return xsi:type="xsd:float">79.46</return>
</ns1:getQuoteResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



But >NET unable to pint result value 79.46 - It just prints nothing!!! If I
use System.Double , then 0 is printed. Please help kindly, thanks a lot.



Best regards,

Ravi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top