Loading ...
Sorry, an error occurred while loading the content.

106Re: .NET interop issues

Expand Messages
  • keithba@microsoft.com
    Mar 15 2:15 PM
    • 0 Attachment
      <just joined this list, so excuse my answering a month old question>

      You can send literal, non section 5, messages that are not datasets.
      Dataset is possible, but many others are as well. For instance:

      <%@ WebService Language="C#" Class="Test" %>

      using System;
      using System.Web.Services;

      public class Test{

      [WebMethod]
      public Foo EchoFoo( Foo foo ){
      return foo;
      }
      }

      public class Foo{

      public string Blah;

      [XmlAttribute]
      public string Blorg;
      }

      will send and recieve Xml (in the body) that looks something like
      this:

      <Foo Blorg="">
      <Blah></Blah>
      </Foo>

      With no section 5 encoding anywhere. Extrapolate this out, and you
      can create classes like the Foo class above that cover a wide variety
      of literal Xml types. (Matter of fact, if you have a schema document,
      you can pass it to the xsd.exe tool in the SDK and it will create
      these classes for you.)

      --- In soapbuilders@y..., priya_m@v... wrote:
      > Hi Paul ,
      > Thanks so much for your post...this certainly does clarify things a
      > little.
      > I have another question..am not sure if it warrants a new
      thread..so
      > I'll just continue with this one...
      > I've been looking into the possibility of sending and receiving
      > literal XML data between my Apache SOAP client and .NET webservice.
      > The .NET web service apparently only allows you to send literal XML
      > if the data type is an MS "dataset" ....this also bloats up the
      > response like crazy !! This is what the .NET response looks like :
      > ================================================================
      > <?xml version="1.0"?>
      > <soap:Envelope
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      > xmlns:soap
      > enc="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:xsi="http://www.w3.org/199
      > 9/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      > <soap:Body>
      > <getParamsResponse xmlns="http://tempuri.org/Response">
      > <result>
      > <xsd:schema id="soapResults" targetNamespace="urn:schema-
      > params-com-soap
      > :" xmlns="urn:schema-params-com-soap:"
      > xmlns:xsd="http://www.w3.org/1999/XMLSche
      > ma" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
      > <xsd:element name="parameters">
      > <xsd:complexType content="elementOnly">
      > <xsd:all>
      > <xsd:element name="active" minOccurs="0"
      > type="xsd:string"/>
      > <xsd:element name="visible" minOccurs="0"
      > type="xsd:string"/>
      > </xsd:all>
      > </xsd:complexType>
      > </xsd:element>
      > <xsd:element name="soapResults" msdata:IsDataSet="True">
      > <xsd:complexType>
      > <xsd:choice maxOccurs="unbounded">
      > <xsd:element ref="parameters"/>
      > </xsd:choice>
      > </xsd:complexType>
      > </xsd:element>
      > </xsd:schema>
      > <a:soapResults version="0.1" dataFormat="recordSet"
      > nColumns="1" method=
      > "getParams" class="IsSOAP.paramsService" nRows="0"
      > xmlns:a="urn:schema-params-com-soap:">
      > <parameters xmlns="">
      > <active>yes</active>
      > <visible>true</visible>
      > </parameters>
      > </a:soapResults>
      > </result>
      > </getParamsResponse>
      > </soap:Body>
      > </soap:Envelope>
      > =================================================================
      > ..and all this just to return values of the 2 parameters i passed !!
      > Is there a more generic way of doing this.....?? Is it posible, at
      > all, to achieve interop as far this is concerned ???
      >
      > regards,
      > Priya
      >
      > --- In soapbuilders@y..., Paul Kulchenko <paulclinger@y...> wrote:
      > > Hi, Priya!
      > >
      > > Here is details from SOAP::Lite documentation. It's specific to
      > > SOAP::Lite implementation, however the same logic will work for
      > > ApacheSOAP also and check explanation of Stefan Pharies about .Net
      > > behavior. Hope it helps.
      > >
      > > Best wishes, Paul.
      > >
      > > =head2 INTEROPERABILITY
      > >
      > > =over 4
      > >
      > > =item Microsoft's .NET
      > >
      > > To use .NET client and SOAP::Lite server
      > >
      > > =over 4
      > >
      > > =item qualify all elements
      > >
      > > use fully qualified names for your return values, e.g.:
      > >
      > > return
      > > SOAP::Data->name('~:myname')->type('string')->value($output);
      > >
      > > In addition see comment about default incoding in .NET Web
      Services
      > > below.
      > >
      > > =back
      > >
      > > To use SOAP::Lite client and .NET server
      > >
      > > =over 4
      > >
      > > =item declare proper soapAction (uri/method) in your call
      > >
      > > For example, use C<on_action(sub{join '', @_})>.
      > >
      > > =item qualify all elements
      > >
      > > Any of following actions should work:
      > >
      > > =over 4
      > >
      > > =item use fully qualified name for method parameters
      > >
      > > Use C<< SOAP::Data->name('~:Query' => 'biztalk') >> instead of
      > > C<< SOAP::Data->name('Query' => 'biztalk') >>.
      > >
      > > Example of SOAPsh call (all parameters should be in one line):
      > >
      > > > perl SOAPsh.pl
      >
      > "http://beta.search.microsoft.com/search/mscomsearchservice.asmx
      > "
      > >
      > > "http://tempuri.org/"
      > > "on_action(sub{join '', @_})"
      > > "GetVocabulary(SOAP::Data->name('~:Query' => 'biztalk'))"
      > >
      > > =item make method in default namespace
      > >
      > > instead of
      > >
      > > my @rc = $soap->call(add => @parms)->result;
      > > # -- OR --
      > > my @rc = $soap->add(@parms)->result;
      > >
      > > use
      > >
      > > my $method = SOAP::Data->name('add')
      > > ->attr({xmlns => 'http://tempuri.org/'});
      > > my @rc = $soap->call($method => @parms)->result;
      > >
      > > =item modify .NET server if you are in charge for that
      > >
      > > Stefan Pharies <stefanph@m...>:
      > >
      > > SOAP::Lite uses the SOAP encoding (section 5 of the soap 1.1
      spec),
      > > and
      > > the default for .NET Web Services is to use a literal encoding. So
      > > elements in the request are unqualified, but your service expects
      > > them to
      > > be qualified. .Net Web Services has a way for you to change the
      > > expected
      > > message format, which should allow you to get your interop
      working.
      > > At the top of your class in the asmx, add this attribute:
      > >
      > > [SoapService(Style=SoapServiceStyle.RPC)]
      > >
      > > Full Web Service text may look like (as far as I understand the
      > > syntax):
      > >
      > > <%@ WebService Language="C#" Class="Test" %>
      > > using System.Web.Services;
      > >
      > > [SoapService(Style=SoapServiceStyle.RPC)]
      > > public class Test : WebService {
      > > [WebMethod]
      > > public int add(int a, int b) {
      > > return a + b;
      > > }
      > > }
      > >
      > > =back
      > >
      > > =back
      > >
      > > Thanks to
      > > Petr Janata <petr.janata@i...>,
      > > Stefan Pharies <stefanph@m...>, and
      > > Brian Jepson <bjepson@j...>
      > > for description and examples.
      > >
      > > =back
      > >
      > >
      > > --- priya_m@v... wrote:
      > > > Hi ,
      > > > I was wondering if anyone has attempted to access .NET services
      > > > from
      > > > an Apache SOAP client...and if so, whether they wud care to
      share
      > > > their experiences. I've been trying to do the same, and found a
      > > > few
      > > > problems, which I also posted to the soap dev newsgroups..and
      > since
      > > > I
      > > > see alot of familiar faces here, shall not repeat that mail.
      > > > Noticed another thing today..I have been attempting to pass a
      > > > string
      > > > parameter to a .NET service...but it was consistently receving a
      > > > null
      > > > instead of the actually param value.
      > > > Used the Messaging classes to construct the payload and send it
      > > > across, experimented with it, and found the following:
      > > >
      > > > a) in the original payload, the body entry for the method name
      > was
      > > > similar to : <ns:sendParam xmlns:ns=blah blah> .... </ns>
      > > > ..and the parameters inside this were not being read correctly
      by
      > > > .NET
      > > >
      > > > b) I modifed the above like so :
      > > > <sendParam .....blah blah>.... </sendParam>..
      > > > and voila !! it works - .NET is now being able to read the
      > correct
      > > > parameters inside this...
      > > >
      > > > what gives ????
      > > >
      > > > regards,
      > > > Priya
      > > >
      > > >
      > > > ------------------------ Yahoo! Groups Sponsor
      > > >
      > > > To unsubscribe from this group, send an email to:
      > > > soapbuilders-unsubscribe@y...
      > > >
      > > >
      > > >
      > >
      > >
      > > __________________________________________________
      > > Do You Yahoo!?
      > > Get personalized email addresses from Yahoo! Mail - only $35
      > > a year! http://personal.mail.yahoo.com/
    • Show all 13 messages in this topic