By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,784 Members | 3,536 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,784 IT Pros & Developers. It's quick & easy.

Problem Calling a web service in .NET

P: n/a
Hello,
I have a webservice running on a J2EE server created with Axis 1.2.. I
have a client that I am building in .net that needs to consume this
webserivce and am having a bit of trouble. I have pasted the wsdl
below and have a created a class in VB.net by adding a web refrence to
my project. What is odd is that I can successfully call methods that
return a simple value like a string. I call also call methods that add
an object. However, for methods the return objects, i always get an
empty object. When methods return arrays of objects, I get the correct
number of records in the array, but none of the fields in the objects
are set. It seems to be a binding problem. Any suggestions as to how I
can get around this?
Regards,
Leslie

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="urn:AuthLogin"
xmlns:tns="urn:AuthLogin"
xmlns:typens="urn:AuthLogin"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- type defs -->
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="urn:AuthLogin"
xmlns="http://www.w3.org/2001/XMLSchema">

<element name="getUserId">
<complexType>
<sequence>
<element name="serviceId" type="xsd:string"/>
<element name="login" type="xsd:string"/>
<element name="password" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getUserIdResponse">
<complexType>
<sequence>
<element name="getUserIdReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="autoResetPassword">
<complexType>
<sequence>
<element name="serviceId" type="xsd:string"/>
<element name="login" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="autoResetPasswordResponse">
<complexType>
<sequence>
<element name="autoResetPasswordReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getLogin">
<complexType>
<sequence>
<element name="serviceId" type="xsd:string"/>
<element name="login" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getLoginResponse">
<complexType>
<sequence>
<element name="getLoginReturn" type="tns:WSLoginValue"/>
</sequence>
</complexType>
</element>
<complexType name="WSLoginValue">
<sequence>
<element name="authFailureCount" type="xsd:int" minOccurs="0"
nillable="false"/>
<element name="changePassword" nillable="false"
type="xsd:dateTime" minOccurs="0"/>
<element name="createDate" nillable="false" type="xsd:dateTime"
minOccurs="0"/>
<element name="createdBy" nillable="false" type="xsd:string"
minOccurs="0"/>
<element name="currentLoginHost" nillable="false"
type="xsd:string" minOccurs="0"/>
<element name="gracePeriodExp" nillable="false"
type="xsd:dateTime" minOccurs="0"/>
<element name="guest" type="xsd:boolean" nillable="false"
minOccurs="0"/>
<element name="lastAuthAttempt" nillable="false"
type="xsd:dateTime" minOccurs="0"/>
<element name="locked" type="xsd:boolean" minOccurs="0"
nillable="false"/>
<element name="login" nillable="false" type="xsd:string"
minOccurs="0"/>
<element name="newUser" type="xsd:boolean" minOccurs="0"
nillable="false"/>
<element name="password" nillable="false" type="xsd:string"
minOccurs="0"/>
<element name="passwordEquivalentToken" nillable="false"
type="xsd:string" minOccurs="0"/>
<element name="passwordExp" nillable="false" type="xsd:dateTime"
minOccurs="0"/>
<element name="resetPassword" type="xsd:boolean" minOccurs="0"
nillable="false"/>
<element name="service" nillable="false" type="xsd:string"
minOccurs="0"/>
<element name="status" nillable="false" type="xsd:string"
minOccurs="0"/>
<element name="token" nillable="false" type="xsd:string"
minOccurs="0"/>
<element name="userId" nillable="false" type="xsd:string"
minOccurs="0"/>
</sequence>
</complexType>
<element name="authenticate">
<complexType>
<sequence>
<element name="serviceId" type="xsd:string" />
<element name="login" type="xsd:string" />
<element name="password" type="xsd:string" />
</sequence>
</complexType>
</element>
<element name="authenticateResponse">
<complexType>
<sequence>
<element name="authenticateResponse" type="tns:SSOSubject" />
</sequence>
</complexType>
</element>
<complexType name="SSOSubject">
<sequence>
<element name="expirationTime" type="xsd:long" nillable="false"
minOccurs="0"/>
<element name="readOnly" type="xsd:boolean" nillable="false"
minOccurs="0"/>
<element name="resultCode" type="xsd:int" nillable="false"
minOccurs="0"/>
<element name="token" nillable="false" type="xsd:string"
minOccurs="0"/>
<element name="userId" nillable="false" type="xsd:string"
minOccurs="0"/>
</sequence>
</complexType>
<element name="authenticateToken">
<complexType>
<sequence>
<element name="userId" type="xsd:string" />
<element name="token" type="xsd:string" />
</sequence>
</complexType>
</element>
<element name="authenticateTokenResponse">
<complexType>
<sequence>
<element name="authenticateTokenReturn" type="tns:SSOSubject" />
</sequence>
</complexType>
</element>
<element name="removeLogin">
<complexType>
<sequence>
<element name="serviceId" type="xsd:string"/>
<element name="loginId" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="removeLoginResponse">
<complexType/>
</element>
<element name="getAllLogins">
<complexType>
<sequence>
<element name="userId" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getAllLoginsResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="getAllLoginsReturn"
type="typens:WSLoginValue"/>
</sequence>
</complexType>
</element>

<element name="logout">
<complexType>
<sequence>
<element name="userId" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="logoutResponse">
<complexType/>
</element>
<element name="addLogin">
<complexType>
<sequence>
<element name="loginValue" type="typens:WSLoginValue"/>
</sequence>
</complexType>
</element>
<element name="addLoginResponse">
<complexType/>
</element>
<element name="updateLogin">
<complexType>
<sequence>
<element name="lv" type="typens:WSLoginValue"/>
</sequence>
</complexType>
</element>
<element name="updateLoginResponse">
<complexType/>
</element>
<element name="encrypt">
<complexType>
<sequence>
<element name="clearText" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="encryptResponse">
<complexType>
<sequence>
<element name="encryptReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="decrypt">
<complexType>
<sequence>
<element name="token" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="decryptResponse">
<complexType>
<sequence>
<element name="decryptReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>

<!-- message -->
<wsdl:message name="authenticateMsg">
<wsdl:part element="typens:authenticate" name="parameters"/>
</wsdl:message>
<wsdl:message name="authenticateResponseMsg">
<wsdl:part element="typens:authenticateResponse"
name="parameters"/>
</wsdl:message>
<wsdl:message name="authenticateTokenMsg">
<wsdl:part element="typens:authenticateToken" name="parameters"/>
</wsdl:message>
<wsdl:message name="authenticateTokenResponseMsg">
<wsdl:part element="typens:authenticateTokenResponse"
name="parameters"/>
</wsdl:message>

<wsdl:message name="getLoginMsg">
<wsdl:part element="typens:getLogin" name="parameters"/>
</wsdl:message>
<wsdl:message name="getLoginResponseMsg">
<wsdl:part element="typens:getLoginResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="logoutMsg">
<wsdl:part element="typens:logout" name="parameters"/>
</wsdl:message>
<wsdl:message name="logoutResponseMsg">
<wsdl:part element="typens:logoutResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="autoResetPasswordMsg">
<wsdl:part element="typens:autoResetPassword" name="parameters"/>
</wsdl:message>
<wsdl:message name="autoResetPasswordResponseMsg">
<wsdl:part element="typens:autoResetPasswordResponse"
name="parameters"/>
</wsdl:message>
<wsdl:message name="getUserIdMsg">
<wsdl:part element="typens:getUserId" name="parameters"/>
</wsdl:message>

<wsdl:message name="getUserIdResponseMsg">
<wsdl:part element="typens:getUserIdResponse" name="parameters"/>
</wsdl:message>

<wsdl:message name="removeLoginMsg">
<wsdl:part element="typens:removeLogin" name="parameters"/>
</wsdl:message>
<wsdl:message name="removeLoginResponseMsg">
<wsdl:part element="tns:removeLoginResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="updateLoginMsg">
<wsdl:part element="typens:updateLogin" name="parameters"/>
</wsdl:message>
<wsdl:message name="updateLoginResponseMsg">
<wsdl:part element="typens:updateLoginResponse"
name="parameters"/>
</wsdl:message>
<wsdl:message name="addLoginMsg">
<wsdl:part element="typens:addLogin" name="parameters"/>
</wsdl:message>
<wsdl:message name="addLoginResponseMsg">
<wsdl:part element="typens:addLoginResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getAllLoginsMsg">
<wsdl:part element="typens:getAllLogins" name="parameters"/>
</wsdl:message>
<wsdl:message name="getAllLoginsResponseMsg">
<wsdl:part element="typens:getAllLoginsResponse"
name="parameters"/>
</wsdl:message>
<wsdl:message name="encryptMsg">
<wsdl:part element="typens:encrypt" name="parameters"/>
</wsdl:message>
<wsdl:message name="encryptResponseMsg">
<wsdl:part element="typens:encryptResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="decryptMsg">
<wsdl:part element="typens:decrypt" name="parameters"/>
</wsdl:message>
<wsdl:message name="decryptResponseMsg">
<wsdl:part element="typens:decryptResponse" name="parameters"/>
</wsdl:message>

<!-- port type -->
<wsdl:portType name="AuthLogin">
<wsdl:operation name="authenticate">
<wsdl:input message="tns:authenticateMsg"
name="authenticateRequest"/>
<wsdl:output message="tns:authenticateResponseMsg"
name="authenticateResponse"/>
</wsdl:operation>
<wsdl:operation name="authenticateToken">
<wsdl:input message="tns:authenticateTokenMsg"
name="authenticateTokenRequest"/>
<wsdl:output message="tns:authenticateTokenResponseMsg"
name="authenticateTokenResponse"/>
</wsdl:operation>
<wsdl:operation name="getUserId">
<wsdl:input message="tns:getUserIdMsg"
name="getUserIdRequest"/>
<wsdl:output message="tns:getUserIdResponseMsg"
name="getUserIdResponse"/>
</wsdl:operation>
<wsdl:operation name="autoResetPassword">
<wsdl:input message="tns:autoResetPasswordMsg"
name="autoResetPasswordRequest"/>
<wsdl:output message="tns:autoResetPasswordResponseMsg"
name="autoResetPasswordResponse"/>
</wsdl:operation>
<wsdl:operation name="getLogin">
<wsdl:input message="tns:getLoginMsg" name="getLoginRequest"/>
<wsdl:output message="tns:getLoginResponseMsg"
name="getLoginResponse"/>
</wsdl:operation>
<wsdl:operation name="removeLogin">
<wsdl:input message="tns:removeLoginMsg"
name="removeLoginRequest"/>
<wsdl:output message="tns:removeLoginResponseMsg"
name="removeLoginResponse"/>
</wsdl:operation>
<wsdl:operation name="getAllLogins">
<wsdl:input message="tns:getAllLoginsMsg"
name="getAllLoginsRequest"/>
<wsdl:output message="tns:getAllLoginsResponseMsg"
name="getAllLoginsResponse"/>
</wsdl:operation>

<wsdl:operation name="logout">
<wsdl:input message="tns:logoutMsg" name="logoutRequest"/>
<wsdl:output message="tns:logoutResponseMsg"
name="logoutResponse"/>
</wsdl:operation>
<wsdl:operation name="addLogin">
<wsdl:input message="tns:addLoginMsg" name="addLoginRequest"/>
<wsdl:output message="tns:addLoginResponseMsg"
name="addLoginResponse"/>
</wsdl:operation>
<wsdl:operation name="updateLogin">
<wsdl:input message="tns:updateLoginMsg"
name="updateLoginRequest"/>
<wsdl:output message="tns:updateLoginResponseMsg"
name="updateLoginResponse"/>
</wsdl:operation>
<wsdl:operation name="encrypt">
<wsdl:input message="tns:encryptMsg" name="encryptRequest"/>
<wsdl:output message="tns:encryptResponseMsg"
name="encryptResponse"/>
</wsdl:operation>
<wsdl:operation name="decrypt">
<wsdl:input message="tns:decryptMsg" name="decryptRequest"/>
<wsdl:output message="tns:decryptResponseMsg"
name="decryptResponse"/>
</wsdl:operation>
</wsdl:portType>

<!-- binding -->
<wsdl:binding name="AuthLoginSoapBinding" type="tns:AuthLogin">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="authenticate">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="authenticateRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="authenticateResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="authenticateToken">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="authenticateTokenRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="authenticateTokenResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="getUserId">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getUserIdRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getUserIdResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="autoResetPassword">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="autoResetPasswordRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="autoResetPasswordResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getLogin">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getLoginRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getLoginResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="removeLogin">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="removeLoginRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="removeLoginResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getAllLogins">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getAllLoginsRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getAllLoginsResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>

<wsdl:operation name="logout">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="logoutRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="logoutResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="addLogin">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="addLoginRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addLoginResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="updateLogin">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="updateLoginRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="updateLoginResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="encrypt">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="encryptRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="encryptResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="decrypt">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="decryptRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="decryptResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AuthLoginService">
<wsdl:port binding="tns:AuthLoginSoapBinding" name="AuthLogin">
<wsdlsoap:address
location="http://localhost:9082/axis/services/AuthLogin"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Nov 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Leslie

There are some stuff that I discovered in the past, that was nice to
know about .NET Java interop regarding webservices.

- Use the "wrapped" convention when generating your WSDL from Axis. It
is default for .NET.
- Conform to the Basic Profile, I think there's a switch for that on the
commandline
- Never expose Java specific types, always convert subclasses of
Collection to plain arrays before making them arguments or return types
for web service methods.

Maybe you know all this, if so, forget.

Abviously the .NET proxy does not know how to deserialize the xml
representing the object your are sending over the wire.

Regards

Henrik
http://websolver.blogspot.com
Nov 23 '05 #2

P: n/a
Hi henrik,

Thanks for your reply. Would you have an example that I could use as
reference to trouble shoot my problem?

Thanks
leslie

Nov 23 '05 #3

P: n/a
le**********@yahoo.com wrote:
Hi henrik,

Thanks for your reply. Would you have an example that I could use as
reference to trouble shoot my problem?


An example of what?

The topics I wrote about was merely common WS interop guidelines between
J2EE and .NET.
Do you have access to the Axis web service? Are you in control of this
(ie. developing it)?
If so, try to set up the wrapped convention. From what I gather from
your previously posted it seems like the WSDL is generated with the
document style convention.
The wrapped convention will "wrap" your parameters (input) into a single
element, instead of passing each parameter one at a time.

You could also check the Axis doc on apache.org searching for the
"wrapped" word.

Also, I remembering seeing a quite like topic on the Axis mailing list.
it was referred to as "the target namespace problem". .NET (and other WS
implementations) use the namespace to identify the exact type being sent
over the wire, thus how to serialize/deserialize it.

HTH

Henrik
Nov 23 '05 #4

P: n/a
Hi Leslie,

You can use J-Integra Espresso to access any J2EE web service from any
..NET client such as VB.NET client. Some of J-Integra Espresso features
include:

* Pure .NET implementation in C#, 100% managed code
* Several times faster than Web Services
* Bi-directional: ".NET to Java", "Java to .NET", ".NET to CORBA" and
"CORBA to .NET"
* Enables interoperability with any J2EE or CORBA infrastructure that
is IIOP-compliant such as VisiBroker, Orbix, JacORB, JBoss, WebLogic,
and WebSphere
* Support for IIOP transport protocols including SSL and TLS over IIOP
(SSLIOP)
* Marshalling objects by reference or by value
* One-sided deployment (no touch on J2EE AppServer)

For a free evaluation, visit http://j-integra.intrinsyc.com/
Regards,

Raymond HE
Intrinsyc Software International, Inc.
J-Integra Interoperability Solutions
http://j-integra.intrinsyc.com/
When Web Services are not enough

Nov 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.