Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie: Help with webservice request.

Status
Not open for further replies.

ROSER72

Technical User
Aug 14, 2007
99
0
0
ES
Hi,

I have very little programming skills and I'm willing to create my first first service request.

The Webservice method I'm trying to invoke is as follows:
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.

POST /ccmmwebservices/CIUtilityWs.asmx HTTP/1.1
Host: 10.85.0.113
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap=" <soap:Body>
<GetServerTime xmlns=" />
</soap:Body>
</soap:Envelope>

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi=" xmlns:xsd=" xmlns:soap=" <soap:Body>
<GetServerTimeResponse xmlns=" <GetServerTimeResult>
<milliseconds xmlns=" </GetServerTimeResult>
</GetServerTimeResponse>
</soap:Body>
</soap:Envelope>


I've created the follwing code:


protected void Login_Click(object sender, EventArgs e)
{
MyServices.CIUtilityWs gs = new MyServices.CIUtilityWs();
long result = gs.GetServerTime();


}

However Visual Studio kepps on telling me that cannot implicitly convert type "MyServices.CIDateTime CIUtilityWs.GetServerTime" to Long.

Can anyone tell me what am I doing wrong?

Thanks in advance,
ROSER72
 
Go Find SoapUI, it's a free download and will save you many headaches. Put in the endpoint for the webservice, send a new request. Ensure that you are getting milliseconds and not a date back.

You can just do a debug.print(gs.GetServerTime()) to see what it's returning.

When you type out the service method it should tell you what the expected return type is.

Lodlaiden

You've got questions and source code. We want both!
 
You need to change it to this:

protected void Login_Click(object sender, EventArgs e)
{
MyServices.CIUtilityWs gs = new MyServices.CIUtilityWs();
var result = gs.GetServerTime();
}

Set you a break point on the bottom bracket and hover over "result" to see what is being returned.

That should help you!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top