Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Filipe Marcelino - 07 Aug 2007 14:31 GMT
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:operation 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:operation 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:operation 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:operation 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
Arne Vajhøj - 07 Aug 2007 17:11 GMT
> after several hours spent searching on groups an answer to my question
> with no success, I decided to post it asking your wise help.
[quoted text clipped - 6 lines]
> - 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
Filipe Marcelino - 24 Aug 2007 10:57 GMT
Hi,

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

((Stub)tst)

ty

On Aug 7, 5:11 pm, Arne Vajh?j <a...@vajhoej.dk> wrote:
> FilipeMarcelinowrote:
> > after several hours spent searching on groups an answer to my question
[quoted text clipped - 30 lines]
>
> Arne
Lew - 24 Aug 2007 14:05 GMT
> 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?

Signature

Lew

Arne Vajhøj - 27 Aug 2007 01:52 GMT
> sorry by the late reply but the compiler doesn't recognize:
>
> ((Stub)tst)

I think it is in javax.xml.rpc !

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.