Thanks for helping ;-)
All responses help me learn more.
Thanks
Peter Henderson
Fred Dushin wrote:
I'm puzzled about what you are trying to do.
Are you trying to generate Java types from WSDL that's housed on a
"secure" HTTP/S URL,
Yes I'd like to access a secured service over https with 'basic'
authentication.
or are you trying to generate code to write a
secure application?
Also yes.
The server is an EJB3 application that i'd like to make available via a
web service. I would like to ensure :
1) all access is over a SSL type connection (at the moment I am using
self signed certificates so I'll need to add the server public keys to
the clients keystore)
2) If possible user/password authentication is used (and propagated to
the the EJB)
My guess is the former, and I am afraid I can't
answer that question, though I would say in general that whatever
service is running at
https://user:[EMAIL PROTECTED]:8181/InsuranceBrokerBeanService/InsuranceBrokerBean?wsdl
should at a minimum require that you specify a trust store against which
to validate any received X.509 certificates sent by the server as part
of the SSL handshake. I believe that in the client case, there may also
be a fallback on your ~/.keystore, so you might be able to configure
that to include trusted CAs that will work in your case, but in general
I would not recommend doing this, for what should be obvious security
reasons.
As far as the second error you had, when you ended up downloading the
WSDL, perhaps you could send the contents of
/home/peter/work/test/webservice3/WebService3Client/InsuranceBrokerBean.wsdl?
The file is attached.
If you need the EJB3 application I can send that also, as it is a very
simple stateless session bean annotated with @WebService then deployed
on glassfish.
Sorry I can't be of more help,
You have helped already, for which I thank you ;-)
-Fred
On Apr 4, 2007, at 11:56 AM, Peter Henderson wrote:
Hi List.
I'm new here and new to web services.
I have created a very simple web service using Glassfish and
@Webservice annotations on a stateless session bean, which I can call
using CXF.
I'd like to do something very similar but with the web service
requiring transport security and authentication, so https and
username/password.
Should wsdl2java be able to support this? Do web services work this way?
What I've tried so far with no success.
/home/peter/downloads/java/apache-cxf/cxf-2.0-incubator-M1/bin/wsdl2java
-verbose -ant -client -d clientdirInsurance/
https://user:[EMAIL PROTECTED]:8181/InsuranceBrokerBeanService/InsuranceBrokerBean?wsdl
Which moans about keystore and truststores, so rather than supply a
whole bunch of -Djavax.net.ssl.keyStore=blah settings I though I'll
download and save the WSDL locally.
(should username/password be optional arguments to wsdl2java?)
[EMAIL PROTECTED]:~/work/play/Tests/cxf$
/home/peter/downloads/java/apache-cxf/cxf-2.0-incubator-M1/bin/wsdl2java
-verbose -ant -client -d clientdirInsurance/
/home/peter/work/test/webservice3/WebService3Client/InsuranceBrokerBean.wsdl
/home/peter/downloads/java/apache-cxf/cxf-2.0-incubator-M1/bin/wsdl2java
wsdl2java -verbose -ant -client -d clientdirInsurance/
/home/peter/work/test/webservice3/WebService3Client/InsuranceBrokerBean.wsdl
wsdl2java - 2.0-incubator-M1
Error : Fail to create wsdl definition
file:/home/peter/work/test/webservice3/WebService3Client/InsuranceBrokerBean.wsdl
org.apache.cxf.tools.common.ToolException: Fail to create wsdl
definition
file:/home/peter/work/test/webservice3/WebService3Client/InsuranceBrokerBean.wsdl
at
org.apache.cxf.tools.wsdl2java.processor.WSDLToProcessor.parseWSDL(WSDLToProcessor.java:165)
at
org.apache.cxf.tools.wsdl2java.processor.WSDLToProcessor.init(WSDLToProcessor.java:360)
at
org.apache.cxf.tools.wsdl2java.processor.WSDLToJavaProcessor.process(WSDLToJavaProcessor.java:54)
at
org.apache.cxf.tools.wsdl2java.WSDLToJava.execute(WSDLToJava.java:85)
at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:69)
at
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:38)
at
org.apache.cxf.tools.wsdl2java.WSDLToJava.main(WSDLToJava.java:218)
Caused by: java.lang.NullPointerException
at java.util.Hashtable.get(Hashtable.java:334)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown
Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
at
org.apache.cxf.tools.wsdl2java.processor.WSDLToProcessor.parseWSDL(WSDLToProcessor.java:157)
... 6 more
Many thanks
Peter Henderson.
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservice3.tests.starjar.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webservice3.tests.starjar.com/" name="InsuranceBrokerBeanService"><wsp:UsingPolicy/><wsp:Policy wsu:Id="InsuranceBrokerBeanPortBinding_findPolicies_WSAT_Policy"><wsp:ExactlyOne><wsp:All><ns1:ATAlwaysCapability xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/10/wsat" wsp:Optional="false"/><ns2:ATAssertion xmlns:ns3="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:ns2="http://schemas.xmlsoap.org/ws/2004/10/wsat" ns3:Optional="true" wsp:Optional="true"/></wsp:All></wsp:ExactlyOne></wsp:Policy><wsp:Policy wsu:Id="InsuranceBrokerBeanPortBinding_loadPolicy_WSAT_Policy"><wsp:ExactlyOne><wsp:All><ns4:ATAlwaysCapa
bility xmlns:ns4="http://schemas.xmlsoap.org/ws/2004/10/wsat" wsp:Optional="false"/><ns5:ATAssertion xmlns:ns6="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:ns5="http://schemas.xmlsoap.org/ws/2004/10/wsat" ns6:Optional="true" wsp:Optional="true"/></wsp:All></wsp:ExactlyOne></wsp:Policy><wsp:Policy wsu:Id="InsuranceBrokerBeanPortBinding_updatePolicy_WSAT_Policy"><wsp:ExactlyOne><wsp:All><ns7:ATAlwaysCapability xmlns:ns7="http://schemas.xmlsoap.org/ws/2004/10/wsat" wsp:Optional="false"/><ns8:ATAssertion xmlns:ns9="http://schemas.xmlsoap.org/ws/2002/12/policy" xmlns:ns8="http://schemas.xmlsoap.org/ws/2004/10/wsat" ns9:Optional="true" wsp:Optional="true"/></wsp:All></wsp:ExactlyOne></wsp:Policy><wsp:Policy wsu:Id="InsuranceBrokerBeanPortBinding_createPolicy_WSAT_Policy"><wsp:ExactlyOne><wsp:All><ns10:ATAlwaysCapability xmlns:ns10="http://schemas.xmlsoap.org/ws/2004/10/wsat" wsp:Optional="false"/><ns11:ATAssertion xmlns:ns12="http://schemas.xmlsoap.org/ws/2002/12/policy" x
mlns:ns11="http://schemas.xmlsoap.org/ws/2004/10/wsat" ns12:Optional="true" wsp:Optional="true"/></wsp:All></wsp:ExactlyOne></wsp:Policy><types><xsd:schema><xsd:import namespace="http://webservice3.tests.starjar.com/" schemaLocation="https://peter-laptop:8181/InsuranceBrokerBeanService/InsuranceBrokerBean?xsd=1"/></xsd:schema></types><message name="loadPolicy"><part name="parameters" element="tns:loadPolicy"/></message><message name="loadPolicyResponse"><part name="parameters" element="tns:loadPolicyResponse"/></message><message name="createPolicy"><part name="parameters" element="tns:createPolicy"/></message><message name="createPolicyResponse"><part name="parameters" element="tns:createPolicyResponse"/></message><message name="updatePolicy"><part name="parameters" element="tns:updatePolicy"/></message><message name="updatePolicyResponse"><part name="parameters" element="tns:updatePolicyResponse"/></message><message name="findPolicies"><part name="parameters" element="tns:f
indPolicies"/></message><message name="findPoliciesResponse"><part name="parameters" element="tns:findPoliciesResponse"/></message><portType name="InsuranceBrokerBean"><operation name="loadPolicy"><input message="tns:loadPolicy"/><output message="tns:loadPolicyResponse"/></operation><operation name="createPolicy"><input message="tns:createPolicy"/><output message="tns:createPolicyResponse"/></operation><operation name="updatePolicy"><input message="tns:updatePolicy"/><output message="tns:updatePolicyResponse"/></operation><operation name="findPolicies"><input message="tns:findPolicies"/><output message="tns:findPoliciesResponse"/></operation></portType><binding name="InsuranceBrokerBeanPortBinding" type="tns:InsuranceBrokerBean"><soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/><operation name="loadPolicy"><wsp:PolicyReference URI="#InsuranceBrokerBeanPortBinding_loadPolicy_WSAT_Policy"/><soap:operation soapAction=""/><input><soap:body use="lit
eral"/></input><output><soap:body use="literal"/></output></operation><operation name="createPolicy"><wsp:PolicyReference URI="#InsuranceBrokerBeanPortBinding_createPolicy_WSAT_Policy"/><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation><operation name="updatePolicy"><wsp:PolicyReference URI="#InsuranceBrokerBeanPortBinding_updatePolicy_WSAT_Policy"/><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation><operation name="findPolicies"><wsp:PolicyReference URI="#InsuranceBrokerBeanPortBinding_findPolicies_WSAT_Policy"/><soap:operation soapAction=""/><input><soap:body use="literal"/></input><output><soap:body use="literal"/></output></operation></binding><service name="InsuranceBrokerBeanService"><port name="InsuranceBrokerBeanPort" binding="tns:InsuranceBrokerBeanPortBinding"><soap:address location="https://peter-laptop:8181/Insur
anceBrokerBeanService/InsuranceBrokerBean"/></port></service></definitions>