You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Pedro Salazar <pe...@ptinovacao.pt> on 2004/01/21 12:48:58 UTC
building axis with optional libraries: question
Greetings,
In the axis documentation, there are some references to building axis
with some optional libraries. However, that is similar to have those
libraries in the lib of the container's server, right? I mean, if I pick
the axis 1.1 release, and I add those libraries in classpath, I will
have the same effect or not?
regards,
Pedro Salazar.
--
PS
pedro-b-salazar_at_ptinovacao_dot_pt
PGP:0E129E31D803BC61
Re: Put wsse info into wsdl generated files?
Posted by Bill Coffman <bi...@yahoo.com>.
Answering my own question:
FooPortType binding = null;
try {
binding = new FooServiceLocator().getfoo(new URL(url));
} catch {
throw AxisFault.makeFault(e);
}
SOAPHeaderElement wsseSecurity = new SOAPHeaderElement(new
PrefixedQName("http://schemas.xmlsoap.org/ws/2002/12/secext", "Security",
"wsse"));
MessageElement usernameToken = new MessageElement("","wsse:UsernameToken");
MessageElement username = new MessageElement("", "wsse:Username");
MessageElement password = new MessageElement("", "wsse:Password");
try {
username.setObjectValue("johnsmith");
usernameToken.addChild(username);
password.setObjectValue("johns_passwd");
password.addAttribute("","Type", "wsse:PasswordText");
usernameToken.addChild(password);
wsseSecurity.addChild(usernameToken);
}
catch (java.lang.Throwable t) {
throw new org.apache.axis.AxisFault("Caught exception, while adding WS-Security
header.", t);
}
org.apache.axis.client.Stub s = (Stub)binding;
s.setHeader(wsseSecurity);
---------------------------------------
Got this from the FAQ. Hope someone finds it helpful.
Bill
--- Bill Coffman <bi...@yahoo.com> wrote:
> Hello all,
>
> Thanks to all of you for making such a great product!
>
> I am building a standalone client to connect to a non-axis server (gSOAP based),
> but
> with WS-Security info required. I have actually done this, but I would like some
> help in doing this the proper AXIS way.
>
> Is there any plans to support WSSE in AXIS? Please let me know if there's a
> better
> way of doing this. Below, is what I have so far.
>
> I generate the java files from my WSDL (WSDL2Java). This works pretty well, but
> then I want to connect to a site that requires authentication (wsse). I have to
> tweak the generated files. I add the below code, just before the
> setRequestHeaders(_call); setAttachments(_call); ... _call.invoke(... statements,
> in
> the XxxBindingStub.java file. Here's the code I add:
>
> SOAPHeaderElement wsseSecurity = new SOAPHeaderElement(new
> PrefixedQName("http://schemas.xmlsoap.org/ws/2002/12/secext", "Security",
> "wsse"));
> MessageElement usernameToken = new MessageElement("","wsse:UsernameToken");
> MessageElement username = new MessageElement("", "wsse:Username");
> MessageElement password = new MessageElement("", "wsse:Password");
> try {
> username.setObjectValue("johnsmith");
> usernameToken.addChild(username);
> password.setObjectValue("johns_passwd");
> password.addAttribute("","Type", "wsse:PasswordText");
> usernameToken.addChild(password);
> wsseSecurity.addChild(usernameToken);
> }
> catch (java.lang.Throwable t) {
> throw new org.apache.axis.AxisFault("Caught exception, while adding WS-Security
> header.", t);
> }
> _call.addHeader(wsseSecurity);
>
>
> Any help in cleaning up this approach would be greatly appreciated.
>
> Thanks,
> Bill
Put wsse info into wsdl generated files?
Posted by Bill Coffman <bi...@yahoo.com>.
Hello all,
Thanks to all of you for making such a great product!
I am building a standalone client to connect to a non-axis server (gSOAP based), but
with WS-Security info required. I have actually done this, but I would like some
help in doing this the proper AXIS way.
Is there any plans to support WSSE in AXIS? Please let me know if there's a better
way of doing this. Below, is what I have so far.
I generate the java files from my WSDL (WSDL2Java). This works pretty well, but
then I want to connect to a site that requires authentication (wsse). I have to
tweak the generated files. I add the below code, just before the
setRequestHeaders(_call); setAttachments(_call); ... _call.invoke(... statements, in
the XxxBindingStub.java file. Here's the code I add:
SOAPHeaderElement wsseSecurity = new SOAPHeaderElement(new
PrefixedQName("http://schemas.xmlsoap.org/ws/2002/12/secext", "Security", "wsse"));
MessageElement usernameToken = new MessageElement("","wsse:UsernameToken");
MessageElement username = new MessageElement("", "wsse:Username");
MessageElement password = new MessageElement("", "wsse:Password");
try {
username.setObjectValue("johnsmith");
usernameToken.addChild(username);
password.setObjectValue("johns_passwd");
password.addAttribute("","Type", "wsse:PasswordText");
usernameToken.addChild(password);
wsseSecurity.addChild(usernameToken);
}
catch (java.lang.Throwable t) {
throw new org.apache.axis.AxisFault("Caught exception, while adding WS-Security
header.", t);
}
_call.addHeader(wsseSecurity);
Any help in cleaning up this approach would be greatly appreciated.
Thanks,
Bill