- - PR -
VC6 から .NET作成のWEBサービス呼出(長文)
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2008-08-20 18:10
こんにちは
VC6 から .NET (VB2005) で作成したWEBサービスを呼び出す 調査をしているのですが 引数が渡せずに困っています。 症状 呼び出しは成功するがサーバ側に引数の値が渡らずに(0初期値のまま) 正常終了となる。 VCからの呼び出しはSOAP Toolkit 3.0のサンプルをもとに呼び出し先等を変更している だけのものです。 サンプルアプリ(VB6でACTIVEX DLL呼び出し)では正常に引数も渡り 意図する結果を得られています。 またVB6から CreateObject("MSSOAP.SoapClient30") を利用しての呼び出しや .NETからの呼び出しも問題なく成功しています。 何か根本的に間違えているのでしょうか? 情報等ありましたらよろしくお願いします。 ------------------------- .NET側コード <WebMethod()> _ Public Function HelloWorld5(ByVal i As Integer, ByVal j As Integer) As String Return "Hello World5 " & (i + j).ToString & "ok" End Function VC側コード #include <stdio.h> #import "msxml4.dll" using namespace MSXML2; #import "C:\\Program Files\\Common Files\\MSSoap\\Binaries\\mssoap30.dll" \\ exclude("IStream", "IErrorInfo", "ISequentialStream", "_LARGE_INTEGER", \\ "_ULARGE_INTEGER", "tagSTATSTG", "_FILETIME") using namespace MSSOAPLib30; void Add2() { ISoapSerializerPtr Serializer; ISoapReaderPtr Reader; ISoapConnectorPtr Connector; // Connect to the service. Connector.CreateInstance(__uuidof(HttpConnector30)); Connector->Property["EndPointURL"] = "http://TEST-SERV:8080/WS_KMAP01/SvKMAP01.asmx?wsdl"; Connector->Connect(); // Begin the message. Connector->Property["SoapAction"] = "http://tempuri.org/HelloWorld5"; Connector->BeginMessage(); // Create the SoapSerializer object. Serializer.CreateInstance(__uuidof(SoapSerializer30)); // Connect the serializer object to the input stream of the connector object. Serializer->Init(_variant_t((IUnknown*)Connector->InputStream)); // Build the SOAP Message. Serializer->StartEnvelope("","",""); Serializer->StartBody(""); Serializer->StartElement("HelloWorld5","http://tempuri.org/WS_KMAP01/","",""); Serializer->StartElement("i","","",""); Serializer->WriteString("5"); Serializer->EndElement(); Serializer->StartElement("j","","",""); Serializer->WriteString("10"); Serializer->EndElement(); Serializer->EndElement(); Serializer->EndBody(); Serializer->EndEnvelope(); // Send the message to the XML Web service. Connector->EndMessage(); // Read the response. Reader.CreateInstance(__uuidof(SoapReader30)); // Connect the reader to the output stream of the connector object. Reader->Load(_variant_t((IUnknown*)Connector->OutputStream), ""); // Display the result. printf("Answer: %s\\n", (const char*)Reader->RpcResult->text); } int main() { CoInitialize(NULL); Add2(); CoUninitialize(); return 0; } |
1