axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus Schaber" <...@soloplan.de>
Subject AW: AW: Axis and WS-Security on a standalone client
Date Fri, 10 Sep 2010 12:01:26 GMT
Hi, Martin,

 

I just cannot figure out how your advice is related to my problem, sorry.

 

Markus

 

**************************************************************************
Soloplan GmbH
Software für Logistik und Planung
Markus Schaber (Dipl.-Informatiker)
Entwicklung, Projektleitung
Burgstraße 20 | 87435 Kempten | Deutschland
Telefon: +49 831 57407-0 | Telefax: +49 831 57407-111
E-Mail: msr@soloplan.de <mailto:msr@soloplan.de>  | Internet: www.soloplan.de <http://www.soloplan.de/>

Geschäftsführer: Wolfgang Heidl, HRB 5304 Kempten

________________________________

Von: Martin Gainty [mailto:mgainty@hotmail.com] 
Gesendet: Freitag, 10. September 2010 13:32
An: java-user@axis.apache.org
Betreff: RE: AW: Axis and WS-Security on a standalone client

 

You must define operation of GetCurrentLocation() with required parameters as well as the
return parameter

<!-- wsdl -->
<definitions 
xmlns:tns="http://soapinterop.org/wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
  <types>
    <schema
            xmlns="http://www.w3.org/2001/XMLSchema"
            xmlns:tns="http://soapinterop.org/types/part"
            targetNamespace="http://soapinterop.org/types/part">
           <element name="vehicleId" type="xsd:int">
            <element name="Lat" type="xsd:int"/>
            <element name="Long"                type="xsd:int">
    </schema>
</types>
  <message name="input">
         <part name="input" element="vehicleId"/>
    </message>
  <message name="output">
        <part name="output1" element="tns:Lat"/>
        <part name="output2" element="tns:Long"/>
    </message>

    <portType name="getCurrentLocationPortType">
        <!--
            Throws an empty fault
        -->
        <operation name="getCurrentLocation" >
            <input message="tns:input"/>
            <output message="tns:output"/>
        </operation>

Martin Gainty 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten
wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist
unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet
keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen
wir keine Haftung fuer den Inhalt uebernehmen.

Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire
prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe
quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information
seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les
email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune
responsabilité pour le contenu fourni.





  
> Subject: AW: Axis and WS-Security on a standalone client
> Date: Fri, 10 Sep 2010 08:11:46 +0200
> From: MSR@soloplan.de
> To: java-user@axis.apache.org
> 
> Hi,
> 
> I also tried to subscribe via the links given on http://ws.apache.org/axis2/mail-lists.html
and they point to obsolete lists, it seems - the resulting mailer daemon message is where
I got redirected to this place.
> 
> Markus
> 
> **************************************************************************
> Soloplan GmbH
> Software für Logistik und Planung
> Markus Schaber (Dipl.-Informatiker)
> Entwicklung, Projektleitung
> Burgstraße 20 | 87435 Kempten | Deutschland
> Telefon: +49 831 57407-0 | Telefax: +49 831 57407-111
> E-Mail: msr@soloplan.de | Internet: www.soloplan.de
> Geschäftsführer: Wolfgang Heidl, HRB 5304 Kempten
> > -----Ursprüngliche Nachricht-----
> > Von: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> > Gesendet: Donnerstag, 9. September 2010 20:49
> > An: java-user@axis.apache.org
> > Betreff: Re: Axis and WS-Security on a standalone client
> > 
> > As part of the promotion of the Axis project to a top level project,
> > we have decided to create separate mailing lists for Axis 1 and Axis2.
> > For all Axis 1 related questions please subscribe and post to
> > axis1-java-user@axis.apache.org. Thanks!
> > 
> > Andreas
> > 
> > 
> > On Thu, Sep 9, 2010 at 17:58, Markus Schaber <MSR@soloplan.de> wrote:
> > > Hello,
> > >
> > > I'm struggling with creating a standalone soap client that employs
> > > WS-Security against a windows (WCF / .NET 3.5) server.
> > >
> > > When removing the WS-Security requirement from the server, everything
> > > works fine. But I just cannot get the java client to send the
> > > appropriate SOAP headers with username and password.
> > >
> > > Most tutorials / FAQs I googled talk about deployment descriptors in
> > > Tomcat, but I do not have that, I just have some small standalone java
> > > application.
> > >
> > > My current state of the art is:
> > >
> > > package test;
> > >
> > > import java.io.IOException;
> > > import java.net.MalformedURLException;
> > > import java.net.URL;
> > >
> > > import javax.security.auth.callback.Callback;
> > > import javax.security.auth.callback.CallbackHandler;
> > > import javax.security.auth.callback.UnsupportedCallbackException;
> > > import javax.xml.rpc.ServiceException;
> > >
> > > import org.apache.ws.security.WSConstants;
> > > import org.apache.ws.security.WSPasswordCallback;
> > > import org.apache.ws.security.handler.WSHandlerConstants;
> > > import org.apache.ws.security.message.token.UsernameToken;
> > >
> > > import de.soloplan.TestServices.GPSPosition;
> > > import de.soloplan.TestServices.TestServiceLocator;
> > > import de.soloplan.TestServices.TestServices;
> > > import de.soloplan.TestServices.TestServicesBindingStub;
> > >
> > > public class TestClass {
> > >
> > >        /**
> > >         * @param args
> > >         * @throws ServiceException
> > >         * @throws MalformedURLException
> > >         */
> > >        public static void main(String[] args) throws Exception {
> > >
> > > System.getProperties().setProperty("javax.net.ssl.trustStore",
> > > "/home/schabi/.keystore");
> > >
> > > System.getProperties().setProperty("javax.net.ssl.keyStore",
> > > "/home/schabi/.keystore");
> > >
> > > System.getProperties().setProperty("javax.net.ssl.keyStorePassword",
> > > "foobar");
> > >
> > > System.getProperties().setProperty("javax.net.ssl.keyStoreType", "JKS");
> > >
> > >                URL url = new
> > > URL("https://localhost:62615/TestService");
> > >
> > >                TestServiceLocator locator = new TestServiceLocator();
> > >
> > >                TestServices service = locator.getTestServicesSOAP(url);
> > >
> > >                TestServicesBindingStub stub = (TestServicesBindingStub)
> > > service;
> > >
> > >                stub._setProperty(UsernameToken.PASSWORD_TYPE,
> > > WSConstants.PASSWORD_DIGEST);
> > >                stub._setProperty(WSHandlerConstants.USER, "test1");
> > >                stub._setProperty(WSHandlerConstants.PW_CALLBACK_REF,
> > > new PWCallback());
> > >
> > >                GPSPosition position = service.getCurrentLocation(-42);
> > >
> > >                System.out.format("Position of vechile %s: Lat: %s,
> > > Long: %s, Height: %s", vehicle, position.getLatitude(),
> > > position.getLongitude(), position.getHeight());
> > >        }
> > >
> > >        public static class PWCallback implements CallbackHandler {
> > >            /**
> > >             * @see
> > > javax.security.auth.callback.CallbackHandler#handle(javax.security.auth.
> > > callback.Callback[])
> > >             */
> > >            public void handle(Callback[] callbacks) throws IOException,
> > >                            UnsupportedCallbackException {
> > >                System.err.println("Called with " + callbacks.length + "
> > > callbacks.");
> > >                for (int i = 0; i < callbacks.length; i++) {
> > >                    if (callbacks[i] instanceof WSPasswordCallback) {
> > >                        WSPasswordCallback pc =
> > > (WSPasswordCallback)callbacks[i];
> > >                        // set the password given a username
> > >                        if ("test1".equals(pc.getIdentifier())) {
> > >                            pc.setPassword("1tset");
> > >                            System.err.println("Set password.");
> > >                        } else {
> > >                                System.err.println("No password
> > > found.");
> > >                        }
> > >                    } else {
> > >                        throw new
> > > UnsupportedCallbackException(callbacks[i], "Unrecognized Callback");
> > >                    }
> > >                }
> > >            }
> > >        }
> > > }
> > >
> > > The stub and locator was autogenerated by eclipse, but if you have any
> > > better Idea, please tell me. I'm also not tied to axis, this was just
> > > what my eclipse autogenerated from the WSDL.
> > >
> > > I tried several different methods I found in google, all that I deemed
> > > to work without a tomcat running, but non success. The application
> > > started fine with no exceptions, but simply did not send the WS-Security
> > > headers to the server.
> > >
> > > With .NET, it is some lines in the App.Config and then barely 20 lines
> > > of code, and it works:
> > >
> > > namespace Soloplan. SoapServer.Tests
> > > {
> > >  using System;
> > >  using System.Diagnostics;
> > >  class TestConsoleApp
> > >  {
> > >    public static void Main()
> > >    {
> > >      var client = new
> > > ServiceReference1.TestServicesClient("TestServicesSOAP",
> > > "https://localhost:62615/TestService");
> > >      Debug.Assert(client.ClientCredentials != null, "No client
> > > credentials");
> > >      client.ClientCredentials.UserName.UserName = "test1";
> > >      client.ClientCredentials.UserName.Password = "1tset";
> > >      Console.WriteLine("got client, sending request");
> > >      var location = client.GetCurrentLocation(-42);
> > >      Console.WriteLine("Got location: {0}/{1}", location.longitude,
> > > location.latitude);
> > >      Console.ReadLine();
> > >    }
> > >  }
> > > }
> > >
> > >
> > > Any ideas?
> > > Markus Schaber
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> > > For additional commands, e-mail: java-user-help@axis.apache.org
> > >
> > >
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> > For additional commands, e-mail: java-user-help@axis.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
> 


Mime
View raw message