Hi...
Thanks for the reply... any help would be GREATLY appreciated! :-)
I need this working ASAP for my project. Thanks I hope this is helpful,
this is all I have.
Here is my client and wsdl.
I did see a posting regarding multiref and have turned it off on the
java service side.
Here is what I have been working with.
FYI: I have a similar Java client (using axis for java) and it works
perfectly against the Java service.
My Java Service configuration: server-config.wsdd
The global config...
<globalConfiguration>
<parameter name="adminPassword" value="admin"/>
<parameter name="attachments.implementation"
value="org.apache.axis.attachments.AttachmentsImpl"/>
<parameter name="sendXsiTypes" value="true"/>
<parameter name="sendMultiRefs" value="false"/>
<parameter name="sendXMLDeclaration" value="true"/>
<requestFlow>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="session"/>
</handler>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="request"/>
<parameter name="extension" value=".jwr"/>
</handler>
</requestFlow>
</globalConfiguration>
Dushshantha Chandradasa wrote:
Hi Gavin,
Sorry for the late reply. For some reason, I didn't get your tar file
attached with your previous mail. So I couldn't reproduce the problem
you stated. Having your server response, I can run the client with
MockServer to test this if I have the client. So could you please attach
your client program and the wsdl file that you have used to generate
codes?
Most of the C++ clients are working with Java Server side when Java
doesn't use href/multiref.
Thanks
Dushshantha
-----Original Message-----
From: Gavin M. Bell [mailto:[EMAIL PROTECTED]
Sent: Friday, September 09, 2005 1:24 AM
To: [email protected]
Subject: Walk with me, please... Has anyone gotten C++ (client) to Java
(webservice) working?
Hello,
I have gone from attempting to use the axis-c binary distribution to the
axis-c source distribution to the cvs tree that I have built myself and
they all lead me back to getting a "(null)" back when processing my Java
web service response. I changed the build scripts to build with '-g'
and have been stepping through the code. I have stepped through enough
to know that the message is getting to the axis-c client and there is
some amount of parsing happening, however, the end result is getting the
pesky "(null)" as my ultimate return value. I am using xerces-c-2_2_0
as my parser.
Is there a know issue with axis-c 1.5 and xerces-c 2.2.0 ?
Has anyone faced this issue?
Thus far I have gdb'd my way into the generated stub code and the
problem is in this call:
xsd__string HelloModel::request(xsd__string Value0)
{
xsd__string Ret;
memset(&Ret,0,sizeof(xsd__string));
const char* pcCmplxFaultName;
try
{
if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER))
return Ret;
if (NULL==m_pCall->getTransportProperty("SOAPAction",false))
{
m_pCall->setTransportProperty(SOAPACTION_HEADER , "");
}
m_pCall->setSOAPVersion(SOAP_VER_1_1);
m_pCall->setOperation("request",
"http://localhost:1595/NaracWS/services/HelloModel");
applyUserPreferences();
m_pCall->addParameter((void*)Value0, "msg", XSD_STRING);
if (AXIS_SUCCESS == m_pCall->invoke())
{
if(AXIS_SUCCESS == m_pCall->checkMessage("requestResponse",
"http://localhost:1595/NaracWS/services/HelloModel"))
{
//************ HELP **************************
//********************************************
//users list mavens... here is the issue... Ret get set to null
//the above invoke() call is run and successfully communicates with the
service.
//********************************************
Ret = m_pCall->getElementAsString("requestReturn", 0);
}
}
m_pCall->unInitialize();
return Ret;
}
catch(AxisException& e)
...
Digging deeper into the code I get to here: (using gdb where command)
#0 0x00c2951c in XMLParserXerces::next () from
/home/cue/obj/bin/libaxis_xerces.so
#1 0x00e5746e in axiscpp::SoapDeSerializer::getElement (this=0x9b8b310,
pName=0x804998a "requestReturn",
pNamespace=0x0, pSimpleType=0xbfff8f70) at
/home/cue/workbench/ws-axis/c/src/soap/SoapDeSerializer.cpp:1884
#2 0x00e57ca8 in axiscpp::SoapDeSerializer::getElementAsString
(this=0x9b8b310,
pName=0x804998a "requestReturn", pNamespace=0x0)
at /home/cue/workbench/ws-axis/c/src/soap/SoapDeSerializer.cpp:2214
#3 0x00e2d7de in axiscpp::Call::getElementAsString (this=0x9b8b310,
pName=0x804998a "requestReturn",
pNamespace=0x0) at
/home/cue/workbench/ws-axis/c/src/engine/client/Call.cpp:500
#4 0x080494e7 in HelloModel::request (this=0xbfff9040, Value0=0x80498aa
"cpp test") at HelloModel.cpp:55
#5 0x08048fe8 in main (argc=1, argv=0xbfff9334) at Client.cpp:56
(gdb)
So.... the next step...
(gdb) step
Single stepping until exit from function _ZN15XMLParserXerces4nextEb,
which has no line number information.
axiscpp::SoapDeSerializer::getElement (this=0x9b8b310, pName=0x804998a
"requestReturn", pNamespace=0x0,
pSimpleType=0xbfff8f70) at
/home/cue/workbench/ws-axis/c/src/soap/SoapDeSerializer.cpp:1886
(gdb)
So I can't look into the xerces library built, I am assuming since it
talks to xerces-c (which I have not compiled with debugging on).
*Question: What is the relationship between the libaxis_xerces.so and
the libxerces-c.so that I built when installing xercesc??? Could this
be where the ball is being dropped???
I have also attached the tcp monitor trace showing the request and
response SOAP messages.
HELP PLEASE, I DON'T KNOW WHAT ELSE TO DO. IT DOESN'T LOOK LIKE IT IS
ANY CODE THAT I HAVE WRITTEN! HELP... :-\
--
------
Gavin M. Bell
Computer Science Research Scientist
Computing Applications and Research Dept.
Lawrence Livermore National Labs
L-103
[EMAIL PROTECTED]
-------
"I'm trying real hard to be the shepherd."
-Samuel Jackson (Pulp Fiction)
==============
Listen Port: 1596
Target Host: localhost
Target Port: 1595
==== Request ====
POST /NaracWS/services/HelloModel HTTP/1.1
Host: localhost:1596
Content-Type: text/xml; charset=UTF-8
SOAPAction: ""
Content-Length: 406
<?xml version='1.0' encoding='utf-8' ?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:request
xmlns:ns1="http://localhost:1595/NaracWS/services/HelloModel">
<msg xsi:type="xsd:string">cpp test</msg>
</ns1:request>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
==== Response ====
HTTP/1.1 200 OK
Server: Resin/3.0.14
Content-Type: text/xml; charset=utf-8
Transfer-Encoding: chunked
Date: Wed, 07 Sep 2005 06:22:27 GMT
0253
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:requestResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://localhost:1595/NaracWS/services/HelloModel">
<requestReturn xsi:type="soapenc:string"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">This is the hello
world! - "cpp test"]</requestReturn>
</ns1:requestResponse>
</soapenv:Body>
</soapenv:Envelope>0
==============
// Copyright 2003-2004 The Apache Software Foundation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "HelloModel.hpp"
#include <axis/AxisException.hpp>
#include <iostream>
static void
usage (char *programName, char *defaultURL)
{
cout << "\nUsage:\n"
<< programName << " [echoString] " << endl
<< " service_url URL of the service.\n"
<< " Default service URL is assumed to be " << defaultURL << endl;
}
int
main (int argc, char *argv[])
{
char endpoint[256];
char original[256];
const char *server = "localhost";
const char *port = "1595";
const char *resultString = "<no-result>";
// Set default service URL
sprintf (endpoint, "http://localhost:1596/NaracWS/services/HelloModel");
sprintf (original, endpoint);
try
{
if (argc < 1)
{
usage (argv[0], endpoint);
return 2;
}
cout << endl << " Using service at " << endpoint << endl << endl;
cout << " Instantiating remote endpoint stub... ";
HelloModel ws(endpoint);
cout << "[OK]" << endl;
cout << " attempting to send the string [cpp test]" <<endl;
printf ("*Before remote call - Result: %s\n", resultString);
resultString = ws.request("cpp test");
printf ("*After remote call - Result: %s\n", resultString);
cout << endl;
}
catch (AxisException & e)
{
printf ("\nException : %s\n", e.what ());
}
catch (exception & e)
{
printf ("\nUnknown exception has occured\n");
}
catch (...)
{
printf ("\nUnknown exception has occured\n");
}
return 0;
}
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains Client Stub implementation for remote web service.
*/
#include "HelloModel.hpp"
#include <axis/AxisWrapperAPI.hpp>
#include <string.h>
using namespace std;
HelloModel::HelloModel(const char* pchEndpointUri, AXIS_PROTOCOL_TYPE eProtocol)
:Stub(pchEndpointUri, eProtocol)
{
}
HelloModel::HelloModel()
:Stub(" ", APTHTTP1_1)
{
m_pCall->setEndpointURI("http://localhost:1595/NaracWS/services/HelloModel");
}
HelloModel::~HelloModel()
{
}
/*Methods corresponding to the web service methods*/
/*
* This method wrap the service method request
*/
xsd__string HelloModel::request(xsd__string Value0)
{
xsd__string Ret;
memset(&Ret,0,sizeof(xsd__string));
const char* pcCmplxFaultName;
try
{
if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER))
return Ret;
if (NULL==m_pCall->getTransportProperty("SOAPAction",false))
{
m_pCall->setTransportProperty(SOAPACTION_HEADER , "");
}
m_pCall->setSOAPVersion(SOAP_VER_1_1);
m_pCall->setOperation("request", "http://localhost:1595/NaracWS/services/HelloModel");
applyUserPreferences();
m_pCall->addParameter((void*)Value0, "msg", XSD_STRING);
if (AXIS_SUCCESS == m_pCall->invoke())
{
if(AXIS_SUCCESS == m_pCall->checkMessage("requestResponse", "http://localhost:1595/NaracWS/services/HelloModel"))
{
Ret = m_pCall->getElementAsString("requestReturn", 0);
}
}
m_pCall->unInitialize();
return Ret;
}
catch(AxisException& e)
{
int iExceptionCode = e.getExceptionCode();
if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
{
throw SoapFaultException(e);
}
ISoapFault* pSoapFault = (ISoapFault*)
m_pCall->checkFault("Fault","http://localhost:1595/NaracWS/services/HelloModel" );
if(pSoapFault)
{
m_pCall->unInitialize();
throw SoapFaultException(e);
}
else throw;
}
}
/*
* This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
* This file contains Client Stub Class for remote web service
*/
#if !defined(__HELLOMODEL_CLIENTSTUB_H__INCLUDED_)
#define __HELLOMODEL_CLIENTSTUB_H__INCLUDED_
#include <axis/client/Stub.hpp>
#include <axis/SoapFaultException.hpp>
#include <axis/ISoapFault.hpp>
AXIS_CPP_NAMESPACE_USE
class HelloModel :public Stub
{
public:
STORAGE_CLASS_INFO HelloModel(const char* pchEndpointUri, AXIS_PROTOCOL_TYPE eProtocol=APTHTTP1_1);
STORAGE_CLASS_INFO HelloModel();
public:
STORAGE_CLASS_INFO virtual ~HelloModel();
public:
STORAGE_CLASS_INFO xsd__string request(xsd__string Value0);
};
#endif /* !defined(__HELLOMODEL_CLIENTSTUB_H__INCLUDED_)*/
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:1595/NaracWS/services/HelloModel" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:1595/NaracWS/services/HelloModel" xmlns:intf="http://localhost:1595/NaracWS/services/HelloModel" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2.1
Built on Jun 14, 2005 (09:15:57 EDT)-->
<wsdl:message name="requestResponse">
<wsdl:part name="requestReturn" type="soapenc:string"/>
</wsdl:message>
<wsdl:message name="requestRequest">
<wsdl:part name="msg" type="soapenc:string"/>
</wsdl:message>
<wsdl:portType name="HelloModel">
<wsdl:operation name="request" parameterOrder="msg">
<wsdl:input message="impl:requestRequest" name="requestRequest"/>
<wsdl:output message="impl:requestResponse" name="requestResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloModelSoapBinding" type="impl:HelloModel">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="request">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="requestRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://hellomodel.services.narac.llnl.gov" use="encoded"/>
</wsdl:input>
<wsdl:output name="requestResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:1595/NaracWS/services/HelloModel" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloModelService">
<wsdl:port binding="impl:HelloModelSoapBinding" name="HelloModel">
<wsdlsoap:address location="http://localhost:1595/NaracWS/services/HelloModel"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>