Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 8th, 2006, 07:14 PM
Registered User
 
Join Date: Dec 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default C# client for SOAP::Lite web service

My company has developed a series of SOAP services using SOAP::Lite on Linux. We've successfully had other Perl, PHP, Ruby and Java clients access the services, but no luck with .NET yet. I've created a simple service to try and identify the problem, which hopefully somebody will be able to help with.

I consume the following document literal (wrapped) WSDL file: http://alpha.wirespring.net/web_serv...SOAP/Demo?WSDL, generate a dll using wsdl.exe and csc. You can re-generate it if you like, but the method call for return_chars() looks like this:

    public string return_chars([System.Xml.Serialization.XmlElementAttribute(
            "return_chars",
            Namespace="urn:Endpoints/SOAP/Demo"
        )] return_chars return_chars1) {
        object[] results = this.Invoke("return_chars", new object[] {
                    return_chars1});
        return ((string)(results[0]));
    }


We then compile a C# client against Demo.dll (the Security section is optional, since we've disabled the authentication to try and work this bug out):

using System;
using System.Diagnostics;
using System.Net;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;

class Example1 {

    public static void Main(string[] args) {
        // Set parameters
        return_chars x = new return_chars();
        x.input_string = "NET SOAP test string";
        x.second_string = "";

        //Security auth_info = new Security();
        //auth_info.Account = "ACCOUNTNAME";
        //auth_info.Username = "username";
        //auth_info.Password = "password";

        Demo myDemo = new Demo();
        //myDemo.SecurityValue = auth_info;
        Console.WriteLine("Got return value: " + myDemo.return_chars(x));
    }
}

When we execute the client, it hits the server, which returns back valid-looking XML, however myDemo.return_chars(x) is null. I used .NET Webservice Studio to examine the response content. This is what the server is sending back:

ResponseCode: 200 (OK)
Pragma:no-cache
SOAPAction:"Endpoints/SOAP/Demo#return_chars"
X-Cache:MISS from alpha.wirespring.net
Transfer-Encoding:chunked
Cache-Control:no-cache
Content-Type:text/xml
Date:Fri, 08 Dec 2006 18:58:43 GMT
Expires:Fri, 08 Dec 2006 18:58:43 GMT
Server:Apache/1.3.34 (Unix) mod_perl/1.29

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <return_charsResponse soap:encodingStyle="http://xml.apache.org/xml-soap/literalxml">
      <s-gensym18 xsi:type="xsd:string">N.E.T. .S.O.A.P .t.e.s.t. .s.t.r.i.n.g</s-gensym18>
    </return_charsResponse>
  </soap:Body>
</soap:Envelope>

The visual tool in .NET WebService Studio also indicates that the result string is null. Oddly, though, when I use the Java-based StrikeIron Web Service Analyzer, I get the exact same return content, but it does correctly grab the return string.

At this point we're about out of ideas, so I'd appreciate any insight that you .NET experts may have!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service Parameter - String vs SOAP attachment ndr1977 .NET Web Services 1 August 31st, 2009 02:02 AM
Need help invoking SOAP web service in C# traderhen .NET Web Services 0 December 12th, 2006 04:34 AM
Passing an argument to a web service from a client dotNETnewbie ASP.NET 2.0 Professional 0 April 10th, 2006 11:38 AM
Web Service Client VandanaD J2EE 0 February 13th, 2006 09:45 PM
Web Service Vs. Client/Server gabrielboys .NET Web Services 10 January 10th, 2006 06:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.