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

Newbee needs help with perl soap lite service and c++ .net client. (hmh)

Expand Messages
  • sarah1878carter
    I have tried just about everything I can think of to get this simple soap service to work. I just can t make it work. It s my first time trying this. It s my
    Message 1 of 1 , Oct 24 10:04 AM
      I have tried just about everything I can think of to get this simple
      soap service to work. I just can't make it work. It's my first time
      trying this. It's my "hello world" version of my little project. I
      have included the code I have so far below. It's all examples found
      in the docs. If you can help, I would be ever so grateful.

      I am using the Microsoft visual studio 2005 programming software,
      visual c++, and the .net framework (managed code).

      My c++ .net framework client is sending the two variables
      successfully to the perl web service. The problem is that nothing is
      returning. No matter how I tweak the code, nothing seems to work out
      for me.

      I see quite a few examples for c# but nothing for the c++ .net
      framework. I am in such distress over this; I'm not sure what to do
      with myself. I could really use a little rescuing.

      Here is the code for the perl soap lite web service:

      #!/usr/bin/perl -w -t
      #!/usr/local/bin/perl -w -t

      #define the path to this script

      use SOAP::Transport::HTTP;

      -> dispatch_to('Example1')
      -> handle;

      package Example1;
      sub Add {
      #get the two variables we sent to this soap server
      my ($self, $temp1, $temp2) = @_ ;
      #send a test email - data was sent correctly - email shows
      both variables
      &sendTheEmail($temp1, $temp2);
      #return the result - does not return! - I do not know why
      #I tried using the decimal type, the int type, and the string
      return SOAP::Data-> name('temp0')
      -> type('decimal')
      -> uri('urn:Example1')
      -> value(42);

      Here is the code for the c++ .net framework (managed code) client:

      #include "stdafx.h"

      #using <System.Web.Services.dll>
      #using <System.Xml.dll>
      #using <System.dll>

      using namespace System::Diagnostics;
      using namespace System::Xml::Serialization;
      using namespace System;
      using namespace System::Web::Services::Protocols;
      using namespace System::Web::Services;

      namespace MyMath

      public ref class MyMath: public

      this->Url =




      int Add( int num1, int num2 )
      array<Object^>^temp0 = {num1,num2};
      array<Object^>^results = this->Invoke( "Add",
      temp0 );
      //I tried both lines below.
      return *dynamic_cast<int^>(results[0]);
      //return (int) results[0];

      System::IAsyncResult^ BeginAdd( int num1, int num2,
      System::AsyncCallback^ callback, Object^ asyncState )
      array<Object^>^temp1 = {num1,num2};
      return this->BeginInvoke( "Add", temp1,
      callback, asyncState );

      int EndAdd( System::IAsyncResult^ asyncResult )
      array<Object^>^results = this->EndInvoke(
      asyncResult );
      return *dynamic_cast<int^>(results[ 0 ]);

      }; //end of class
      } //end of namespace

      void main()
      ("start: hit enter");

      ("Calling the big SOAP Server to say hello");
      MyMath::MyMath^ callMyMath = gcnew MyMath::MyMath();

      //my soap service gets the two variables but does not return
      a value. thus, the below line is always 0.
      ("The SOAP Server says: " + callMyMath->Add(14, 21));

      ("end: hit enter");

      I would be ever so grateful for any help...:)
    Your message has been successfully submitted and would be delivered to recipients shortly.