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

Re: [soapbuilders] PROBLEM: C# Web Service - Invoked from a VC++ 6.0 Client (MS-SOAP)

Expand Messages
  • George Rusev
    Hi, I think that request to base operation is not correct. The request you send is:
    Message 1 of 2 , Apr 23, 2004
    • 0 Attachment
      Hi,

      I think that request to base operation is not correct.
      The request you send is:

      <SOAPSDK4:GreetMe
      xmlns:SOAPSDK4="http://172.16.1.95/WebServices/ws1/"
      SOAP-ENV:encodingStyle="">
      <SOAPSDK5:sName
      xmlns:SOAPSDK5="http://172.16.1.95/WebServices/ws1/GreetMe"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">Nirav</SOAPSDK5:sName>
      </SOAPSDK4:GreetMe>

      However, ussually the base service .NET type will
      expect Document style with literal encoding, and in
      this is the request that would satisfy that:

      <SOAPSDK4:GreetMe
      xmlns:SOAPSDK4="http://172.16.1.95/WebServices/ws1/"
      SOAP-ENV:encodingStyle="">
      <SOAPSDK4:sName>Nirav</SOAPSDK5:sName>
      </SOAPSDK4:GreetMe>

      OR .NET uses also RPC style encoded requests. In this
      terms the request would have been:

      <SOAPSDK4:GreetMe
      xmlns:SOAPSDK4="http://172.16.1.95/WebServices/ws1/"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <sName>Nirav</sName>
      </SOAPSDK4:GreetMe>

      To determine the correct style AND encoding look at
      service WSDL in its binding section.

      Regards,
      George Rusev



      --- Nirav Doshi <ndsrl@...> wrote:
      > Hello,
      >
      > I'm a kindof newbie to SOAP, so please help me with
      > this problem. It
      > could be a very basic one, but I'm trying to figure
      > out what's wrong
      > in this, since a couple of days now! The webservice
      > runs fine when
      > invoked from IE, but from my app, it doesn't receive
      > the parameter.
      >
      > Here's my setup information & code segments to help
      > you help me: :-)
      >
      > * Server End:
      > Windows Server 2003 Enterprise Edition, IIS 6.0,
      > VS.NET 2003
      >
      > * Web Service:
      > The C# web service is just supposed to receive a
      > string and return
      > a string.
      > ///////////////////
      > Code Segment:
      > [WebMethod (CacheDuration = 30)]
      > public string GreetMe(string sName)
      > {
      > return ("Hello " + sName + "!");
      > }
      > ///////////////////
      >
      > * At the Client End:
      > VC++ (MFC) - Using MS-SOAP Toolkit 3.0
      > I am not using a WSDL file, and I am directly
      > trying to invoke the
      > Web Service.
      >
      > Code:
      > ///////////////////////////////////////
      > void CSOAPClientDlg::OnBtnGetString() /// Gets a
      > string and sends it
      > to the webservice GreetMe()!
      > {
      > //{
      > try
      > {
      > ISoapConnectorPtr psmConnector = NULL;
      > ISoapSerializerPtr psmSerializer = NULL;
      > ISoapReaderPtr psmReader = NULL;
      >
      > ////////
      > CString csName;
      >
      >
      psmConnector.CreateInstance(__uuidof(HttpConnector30));
      > psmConnector->Property["EndPointURL"]
      > =
      > "http://172.16.1.95/WebServices/ws1/Service1.asmx";
      > psmConnector->Connect();
      >
      > psmConnector->Property["SoapAction"]
      > = "http://172.16.1.95/WebServices/ws1/GreetMe";
      >
      > psmConnector->BeginMessage();
      >
      >
      psmSerializer.CreateInstance(__uuidof(SoapSerializer30));
      > psmSerializer->Init(_variant_t((IUnknown *)
      > psmConnector->
      > InputStream));
      > psmSerializer->StartEnvelope("", "STANDARD", "");
      > psmSerializer->StartBody("STANDARD");
      > psmSerializer->StartElement
      > ("GreetMe", "http://172.16.1.95/WebServices/ws1/",
      > "", "");
      > psmSerializer->StartElement("sName", "",
      > "STANDARD", "");
      >
      > GetDlgItem(IDC_TXT_GREET)->GetWindowText(csName);
      >
      > psmSerializer->WriteString(csName.AllocSysString());
      > psmSerializer->EndElement();
      > psmSerializer->EndElement();
      > psmSerializer->EndBody();
      > psmSerializer->EndEnvelope();
      > psmConnector->EndMessage();
      >
      > psmReader.CreateInstance(__uuidof(SoapReader30));
      >
      > psmReader->Load(_variant_t((IUnknown *)
      > psmConnector-
      > >OutputStream), "");
      >
      > GetDlgItem(IDC_TXT_XML)->SetWindowText((const char
      > *)
      > psmReader->RpcResult->xml);
      > GetDlgItem(IDC_TXT_GREET)->SetWindowText((const
      > char
      > *) psmReader->RpcResult->text);
      >
      > psmConnector.Release();
      > psmSerializer.Release();
      > psmReader.Release();
      > ////////
      >
      > psmSerializer = NULL;
      > psmReader = NULL;
      > psmConnector = NULL;
      > }
      > catch(...)
      > {
      > AfxMessageBox("Something Wrong! - 1");
      > }
      > //}
      > }
      > ///////////////////////////////////////
      >
      > * Problem:
      > When I provide the "String" in the dialog, the
      > function above
      > sends it in a SOAP request to my server
      > (172.16.1.95). But the
      > response from the server is just "Hello !" -
      > Without the string
      > that was sent to the server.
      >
      > * On capturing the packet being sent, I have the
      > following SOAP
      > Request being sent to the server (172.16.1.95 -
      > www.sherkhan.com) on
      > my local network:
      > -----------
      > POST /WebServices/ws1/Service1.asmx HTTP/1.1
      > SOAPAction:
      > "http://172.16.1.95/WebServices/ws1/GreetMe"
      > Content-Type: text/xml; charset="UTF-8"
      > User-Agent: SOAP Toolkit 3.0
      > Host: 172.16.1.95
      > Content-Length: 776
      > Connection: Keep-Alive
      > Cache-Control: no-cache
      > Pragma: no-cache
      >
      > <?xml version="1.0" encoding="UTF-8"
      > standalone="no"?>
      > <SOAP-ENV:Envelope SOAP-
      >
      ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      >
      > xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
      >
      xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
      >
      >
      xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:SOAP-
      > ENV="http://schemas.xmlsoap.org/soap/envelope/">
      > <SOAP-ENV:Body SOAP-
      >
      ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      > <SOAPSDK4:GreetMe
      > xmlns:SOAPSDK4="http://172.16.1.95/WebServices/ws1/"
      > SOAP-
      > ENV:encodingStyle="">
      > <SOAPSDK5:sName
      >
      xmlns:SOAPSDK5="http://172.16.1.95/WebServices/ws1/GreetMe"
      > SOAP-
      >
      ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">Nirav</S
      > OAPSDK5:sName>
      > </SOAPSDK4:GreetMe>
      > </SOAP-ENV:Body>
      > </SOAP-ENV:Envelope>
      > -----------
      >
      > The "sName" parameter being sent in the message is
      > not being received
      > at the webservice end at all. Hence the reply
      > message is without
      > the "sName" value.
      >
      > Thanks, in advance!
      > Rgds,
      >
      > Nirav
      >
      >





      __________________________________
      Do you Yahoo!?
      Yahoo! Photos: High-quality 4x6 digital prints for 25�
      http://photos.yahoo.com/ph/print_splash
    Your message has been successfully submitted and would be delivered to recipients shortly.