osdir.com
mailing list archive
Mozy Online Backup: 2GB Free. Automatic. Secure.

Subject: Re: SOAP Client access to Web service problem - msg#00001

List: windows.devel.soap.general

Date: Prev Next Index Thread: Prev Next Index
Try csoap
http://csoap.sourceforge.net

On Thu, 2004-05-13 at 18:05, Muralidhar Bojja wrote:
> Hi,
>
> I would like to map the following Java code to C++.
> I made an attempt to succeed with MS SOAP Toolkit 2.0, but I could not find
> where is the mistake.
>
> It does not matter to me, whether the solution uses SOAP message or not(just
> uses stream). I just want to work with the web service with the given
> parameters.
>
> For instance, the below given java code just works fine without any soap
> message, rather with a stream.
>
>
> Any solutions or suggestions are appreciated.
>
> ----------- Java Code --------------
> import java.net.*;
> import java.io.*;
>
> public class CrakFrame {
> public static void main(String arg[]) {
> try {
> URL url = new URL("xyz");
> URLConnection connection = url.openConnection();
> connection.setDoOutput(true);
> PrintWriter out = new
> PrintWriter(connection.getOutputStream());
> out.print("Petition");
> out.print("=");
>
> out.print("<AvailableColours><Colour>Red</Colour></AvailableColours>");
> out.close();
> BufferedReader in = new BufferedReader(new
> InputStreamReader(connection.getInputStream()));
> boolean more = true;
> while(more) {
> String line = in.readLine();
> if(line == null) more = false;
> else System.out.println(line);
> }
> }catch (IOException e) {e.printStackTrace();}
> }
> }
>
>
> ----------- Visual C++ code ------------------
>
> #include <stdio.h>
> #include <fstream.h>
> #include <stdlib.h> // for exit()
>
> #import "msxml3.dll"
> using namespace MSXML2;
>
> #import "D:\Program Files\Common Files\MSSoap\Binaries\MSSOAP1.dll" \
> exclude("IStream", "ISequentialStream", "_LARGE_INTEGER", \
> "_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME")
> using namespace MSSOAPLib;
>
> int main (void)
> {
>
> CoInitialize(NULL);
>
> ISoapSerializerPtr Serializer;
> ISoapReaderPtr Reader;
> ISoapConnectorPtr Connector;
>
> // Connect to the service
> Connector.CreateInstance(__uuidof(HttpConnector));
> Connector->Property["EndPointURL"] =
> "http://213.170.46.114:8004/Service1.asmx?op=FurnitureDB";;
> Connector->Connect();
>
> // Begin message
> Connector->Property["SoapAction"] = "http://www.indra.es/FurnitureDB";;
> Connector->BeginMessage();
>
> // Create the SoapSerializer
> Serializer.CreateInstance(__uuidof(SoapSerializer));
>
> // Connect the serializer to the input stream of the connector
> Serializer->Init(_variant_t((IUnknown*)Connector->InputStream));
>
> // Build the SOAP Message
> Serializer->startEnvelope("SOAP","","");
> Serializer->startBody("");
>
>
> Serializer->startElement("Petition","http://www.indra.es/FurnitureDB","","";);
> Serializer->startElement("AvailableColours","","","");
> Serializer->startElement("Colour","","","");
>
> Serializer->writeString("Red");
>
> Serializer->endElement();
> Serializer->endElement();
> Serializer->endElement();
>
> Serializer->endBody();
> Serializer->endEnvelope();
>
> // Send the message to the web service
> Connector->EndMessage();
>
> // Let us read the response
> Reader.CreateInstance(__uuidof(SoapReader));
>
> // Connect the reader to the output stream of the connector
> Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), "");
>
> // Display the result
> printf("Answer: %s\n", (const char *)Reader->RPCResult->text);
>
> // Close the Service
> CoUninitialize();
>
> return 0;
> }
>
>
>
> --
> Bojja



Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

SOAP Client access to Web service problem

Hi, I would like to map the following Java code to C++. I made an attempt to succeed with MS SOAP Toolkit 2.0, but I could not find where is the mistake. It does not matter to me, whether the solution uses SOAP message or not(just uses stream). I just want to work with the web service with the given parameters. For instance, the below given java code just works fine without any soap message, rather with a stream. Any solutions or suggestions are appreciated. ----------- Java Code -------------- import java.net.*; import java.io.*; public class CrakFrame { public static void main(String arg[]) { try { URL url = new URL("xyz"); URLConnection connection = url.openConnection(); connection.setDoOutput(true); PrintWriter out = new PrintWriter(connection.getOutputStream()); out.print("Petition"); out.print("="); out.print("<AvailableColours><Colour>Red</Colour></AvailableColours>"); out.close(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); boolean more = true; while(more) { String line = in.readLine(); if(line == null) more = false; else System.out.println(line); } }catch (IOException e) {e.printStackTrace();} } } ----------- Visual C++ code ------------------ #include <stdio.h> #include <fstream.h> #include <stdlib.h> // for exit() #import "msxml3.dll" using namespace MSXML2; #import "D:\Program Files\Common Files\MSSoap\Binaries\MSSOAP1.dll" \ exclude("IStream", "ISequentialStream", "_LARGE_INTEGER", \ "_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME") using namespace MSSOAPLib; int main (void) { CoInitialize(NULL); ISoapSerializerPtr Serializer; ISoapReaderPtr Reader; ISoapConnectorPtr Connector; // Connect to the service Connector.CreateInstance(__uuidof(HttpConnector)); Connector->Property["EndPointURL"] = "http://213.170.46.114:8004/Service1.asmx?op=FurnitureDB"; Connector->Connect(); // Begin message Connector->Property["SoapAction"] = "http://www.indra.es/FurnitureDB"; Connector->BeginMessage(); // Create the SoapSerializer Serializer.CreateInstance(__uuidof(SoapSerializer)); // Connect the serializer to the input stream of the connector Serializer->Init(_variant_t((IUnknown*)Connector->InputStream)); // Build the SOAP Message Serializer->startEnvelope("SOAP","",""); Serializer->startBody(""); Serializer->startElement("Petition","http://www.indra.es/FurnitureDB","",""); Serializer->startElement("AvailableColours","","",""); Serializer->startElement("Colour","","",""); Serializer->writeString("Red"); Serializer->endElement(); Serializer->endElement(); Serializer->endElement(); Serializer->endBody(); Serializer->endEnvelope(); // Send the message to the web service Connector->EndMessage(); // Let us read the response Reader.CreateInstance(__uuidof(SoapReader)); // Connect the reader to the output stream of the connector Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), ""); // Display the result printf("Answer: %s\n", (const char *)Reader->RPCResult->text); // Close the Service CoUninitialize(); return 0; } -- Bojja

Next Message by Date: click to view message preview

Re: SOAP Digest - 29 Apr 2004 to 13 May 2004 (#2004-22)

What about gSOAP? Works smoothly, C++ implementation, very little fuss and widely accepted: http://www.cs.fsu.edu/~engelen/soap.html ~~Razvan Hi, I would like to map the following Java code to C++. I made an attempt to succeed with MS SOAP Toolkit 2.0, but I could not find where is the mistake. It does not matter to me, whether the solution uses SOAP message or not(just uses stream). I just want to work with the web service with the given parameters. For instance, the below given java code just works fine without any soap message, rather with a stream.

Previous Message by Thread: click to view message preview

SOAP Client access to Web service problem

Hi, I would like to map the following Java code to C++. I made an attempt to succeed with MS SOAP Toolkit 2.0, but I could not find where is the mistake. It does not matter to me, whether the solution uses SOAP message or not(just uses stream). I just want to work with the web service with the given parameters. For instance, the below given java code just works fine without any soap message, rather with a stream. Any solutions or suggestions are appreciated. ----------- Java Code -------------- import java.net.*; import java.io.*; public class CrakFrame { public static void main(String arg[]) { try { URL url = new URL("xyz"); URLConnection connection = url.openConnection(); connection.setDoOutput(true); PrintWriter out = new PrintWriter(connection.getOutputStream()); out.print("Petition"); out.print("="); out.print("<AvailableColours><Colour>Red</Colour></AvailableColours>"); out.close(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); boolean more = true; while(more) { String line = in.readLine(); if(line == null) more = false; else System.out.println(line); } }catch (IOException e) {e.printStackTrace();} } } ----------- Visual C++ code ------------------ #include <stdio.h> #include <fstream.h> #include <stdlib.h> // for exit() #import "msxml3.dll" using namespace MSXML2; #import "D:\Program Files\Common Files\MSSoap\Binaries\MSSOAP1.dll" \ exclude("IStream", "ISequentialStream", "_LARGE_INTEGER", \ "_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME") using namespace MSSOAPLib; int main (void) { CoInitialize(NULL); ISoapSerializerPtr Serializer; ISoapReaderPtr Reader; ISoapConnectorPtr Connector; // Connect to the service Connector.CreateInstance(__uuidof(HttpConnector)); Connector->Property["EndPointURL"] = "http://213.170.46.114:8004/Service1.asmx?op=FurnitureDB"; Connector->Connect(); // Begin message Connector->Property["SoapAction"] = "http://www.indra.es/FurnitureDB"; Connector->BeginMessage(); // Create the SoapSerializer Serializer.CreateInstance(__uuidof(SoapSerializer)); // Connect the serializer to the input stream of the connector Serializer->Init(_variant_t((IUnknown*)Connector->InputStream)); // Build the SOAP Message Serializer->startEnvelope("SOAP","",""); Serializer->startBody(""); Serializer->startElement("Petition","http://www.indra.es/FurnitureDB","",""); Serializer->startElement("AvailableColours","","",""); Serializer->startElement("Colour","","",""); Serializer->writeString("Red"); Serializer->endElement(); Serializer->endElement(); Serializer->endElement(); Serializer->endBody(); Serializer->endEnvelope(); // Send the message to the web service Connector->EndMessage(); // Let us read the response Reader.CreateInstance(__uuidof(SoapReader)); // Connect the reader to the output stream of the connector Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), ""); // Display the result printf("Answer: %s\n", (const char *)Reader->RPCResult->text); // Close the Service CoUninitialize(); return 0; } -- Bojja

Next Message by Thread: click to view message preview

Re: SOAP Digest - 29 Apr 2004 to 13 May 2004 (#2004-22)

What about gSOAP? Works smoothly, C++ implementation, very little fuss and widely accepted: http://www.cs.fsu.edu/~engelen/soap.html ~~Razvan Hi, I would like to map the following Java code to C++. I made an attempt to succeed with MS SOAP Toolkit 2.0, but I could not find where is the mistake. It does not matter to me, whether the solution uses SOAP message or not(just uses stream). I just want to work with the web service with the given parameters. For instance, the below given java code just works fine without any soap message, rather with a stream.
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by