Consuming a .NET Webservie with a Java/AXIS secure client

  • Thread starter Filipe Marcelino
  • Start date
F

Filipe Marcelino

Hi all,

after several hours spent searching on groups an answer to my question
with no success, I decided to post it asking your wise help.

This is my current situation: I have a webservice written in VB.NET
with the following webMethods:

- HelloWorld() As String
- GetDate() As Date
- GetXMLFile() As String
- GetBinaryFile() As Byte()

Begin WSDL:

<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://
www.w3.org/2001/XMLSchema" xmlns:s0="http://tempuri.org/WebService1/
Service1" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://tempuri.org/WebService1/Service1"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified" targetNamespace="http://
tempuri.org/WebService1/Service1">
<s:element name="HelloWorld">
<s:complexType />
</s:element>
<s:element name="HelloWorldResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="HelloWorldResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetDate">
<s:complexType />
</s:element>
<s:element name="GetDateResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1"
name="GetDateResult" type="s:dateTime" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetXMLFile">
<s:complexType />
</s:element>
<s:element name="GetXMLFileResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetXMLFileResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="GetBinaryFile">
<s:complexType />
</s:element>
<s:element name="GetBinaryFileResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetBinaryFileResult" type="s:base64Binary" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
<message name="HelloWorldSoapIn">
<part name="parameters" element="s0:HelloWorld" />
</message>
<message name="HelloWorldSoapOut">
<part name="parameters" element="s0:HelloWorldResponse" />
</message>
<message name="GetDateSoapIn">
<part name="parameters" element="s0:GetDate" />
</message>
<message name="GetDateSoapOut">
<part name="parameters" element="s0:GetDateResponse" />
</message>
<message name="GetXMLFileSoapIn">
<part name="parameters" element="s0:GetXMLFile" />
</message>
<message name="GetXMLFileSoapOut">
<part name="parameters" element="s0:GetXMLFileResponse" />
</message>
<message name="GetBinaryFileSoapIn">
<part name="parameters" element="s0:GetBinaryFile" />
</message>
<message name="GetBinaryFileSoapOut">
<part name="parameters" element="s0:GetBinaryFileResponse" />
</message>
<portType name="Service1Soap">
<operation name="HelloWorld">
<input message="s0:HelloWorldSoapIn" />
<output message="s0:HelloWorldSoapOut" />
</operation>
<operation name="GetDate">
<input message="s0:GetDateSoapIn" />
<output message="s0:GetDateSoapOut" />
</operation>
<operation name="GetXMLFile">
<input message="s0:GetXMLFileSoapIn" />
<output message="s0:GetXMLFileSoapOut" />
</operation>
<operation name="GetBinaryFile">
<input message="s0:GetBinaryFileSoapIn" />
<output message="s0:GetBinaryFileSoapOut" />
</operation>
</portType>
<binding name="Service1Soap" type="s0:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="HelloWorld">
<soap:eek:peration soapAction="http://tempuri.org/WebService1/
Service1/HelloWorld" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="GetDate">
<soap:eek:peration soapAction="http://tempuri.org/WebService1/
Service1/GetDate" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="GetXMLFile">
<soap:eek:peration soapAction="http://tempuri.org/WebService1/
Service1/GetXMLFile" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="GetBinaryFile">
<soap:eek:peration soapAction="http://tempuri.org/WebService1/
Service1/GetBinaryFile" style="document" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="Service1">
<port name="Service1Soap" binding="s0:Service1Soap">
<soap:address location="http://apliurbcli4/WebService1/
Service1.asmx" />
</port>
</service>
</definitions>

End WSDL:

I have a Java/AXIS client that can consume those methods, but without
authentication. I want to be able to write a Java/AXIS client that
asks for a username/password to use those webmethods. If someone know
how to do it, please point me some tutorial or some source to me.

If i'm not being clear, please let me know.

Thanks in advance for your attention,
Filipe Marcelino
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Filipe said:
after several hours spent searching on groups an answer to my question
with no success, I decided to post it asking your wise help.

This is my current situation: I have a webservice written in VB.NET
with the following webMethods:

- HelloWorld() As String
- GetDate() As Date
- GetXMLFile() As String
- GetBinaryFile() As Byte()
I have a Java/AXIS client that can consume those methods, but without
authentication. I want to be able to write a Java/AXIS client that
asks for a username/password to use those webmethods. If someone know
how to do it, please point me some tutorial or some source to me.

I think you need to make sure that the web services uses BASIC
authentication, since I doubt that Axis and/or Java support
NTLM.

Then you just need to specify that you want to keep session and
specify username & password in the client.

When I played with that many years ago with Axis 1 the client
code was:

TestService service = new TestServiceLocator();
Test tst = service.getTestService();
((Stub)tst)._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, new
Boolean(true));
((Stub)tst)._setProperty(Stub.USERNAME_PROPERTY, "wsuser1");
((Stub)tst)._setProperty(Stub.PASSWORD_PROPERTY, "hemmeligt");

Arne
 
F

Filipe Marcelino

Hi,

sorry by the late reply but the compiler doesn't recognize:

((Stub)tst)

ty
 
L

Lew

Filipe said:
Hi,

sorry by the late reply but the compiler doesn't recognize:

((Stub)tst)

Please trim your responses and do not top-post.

Did you have an import for Stub?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top