On Katherine and Dennis behest I decided to tackle the WSDL which incorporated WS-Policy 1.5 as wsp:Policy elements here is library.wsdl <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://ws.sosnoski.com/library/wsdl" xmlns:wns="http://ws.sosnoski.com/library/wsdl" xmlns:tns="http://ws.sosnoski.com/library/types" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"> <!-- Policy for signing message, with certificate from client included in each message to server --> <wsp:Policy wsu:Id="SignOnly" 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"> <wsp:ExactlyOne> <wsp:All> <sp:AsymmetricBinding xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <wsp:Policy> <sp:InitiatorToken> <wsp:Policy> <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> </wsp:Policy> </sp:InitiatorToken> <sp:RecipientToken> <wsp:Policy> <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToInitiator"/> </wsp:Policy> </sp:RecipientToken> <sp:AlgorithmSuite> <wsp:Policy> <sp:TripleDesRsa15/> </wsp:Policy> </sp:AlgorithmSuite> <sp:Layout> <wsp:Policy> <sp:Strict/> </wsp:Policy> </sp:Layout> <sp:IncludeTimestamp/> <sp:OnlySignEntireHeadersAndBody/> </wsp:Policy> </sp:AsymmetricBinding> <sp:SignedParts xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <sp:Body/> </sp:SignedParts> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> <!-- Policy for Username Token with plaintext password, sent from client to server only --> <wsp:Policy wsu:Id="UsernameToken" 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"> <wsp:ExactlyOne> <wsp:All> <sp:SupportingTokens xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> <wsp:Policy> <sp:UsernameToken sp:IncludeToken= "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> </wsp:Policy> </sp:SupportingTokens> </wsp:All> </wsp:ExactlyOne> </wsp:Policy> <wsdl:types> <schema elementFormDefault="qualified" targetNamespace="http://ws.sosnoski.com/library/wsdl" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://ws.sosnoski.com/library/types"/> <element name="getBook"> <complexType> <sequence> <element name="isbn" type="string"/> </sequence> </complexType> </element> <element name="getBookResponse"> <complexType> <sequence> <element name="getBookReturn" minOccurs="0" type="tns:BookInformation"/> </sequence> </complexType> </element> <element name="getBooksByType"> <complexType> <sequence> <element name="type" type="string"/> </sequence> </complexType> </element> <element name="getBooksByTypeResponse"> <complexType> <sequence> <element name="getBooksByTypeReturn" minOccurs="0" maxOccurs="unbounded" type="tns:BookInformation"/> </sequence> </complexType> </element> <element name="addBook"> <complexType> <sequence> <element name="type" type="string"/> <element name="isbn" type="string"/> <element name="author" minOccurs="0" maxOccurs="unbounded" type="string"/> <element name="title" type="string"/> </sequence> </complexType> </element> <element name="addBookResponse"> <complexType> <sequence> <element name="addBookReturn" type="boolean"/> </sequence> </complexType> </element> </schema> <schema elementFormDefault="qualified" targetNamespace="http://ws.sosnoski.com/library/types" xmlns="http://www.w3.org/2001/XMLSchema"> <complexType name="BookInformation"> <sequence> <element name="author" minOccurs="0" maxOccurs="unbounded" type="string"/> <element name="title" type="string"/> </sequence> <attribute name="type" use="required" type="string"/> <attribute name="isbn" use="required" type="string"/> </complexType> </schema> </wsdl:types> <wsdl:message name="getBookRequest"> <wsdl:part element="wns:getBook" name="parameters"/> </wsdl:message> <wsdl:message name="getBookResponse"> <wsdl:part element="wns:getBookResponse" name="parameters"/> </wsdl:message> <wsdl:message name="getBooksByTypeRequest"> <wsdl:part element="wns:getBooksByType" name="parameters"/> </wsdl:message> <wsdl:message name="getBooksByTypeResponse"> <wsdl:part element="wns:getBooksByTypeResponse" name="parameters"/> </wsdl:message> <wsdl:message name="addBookRequest"> <wsdl:part element="wns:addBook" name="parameters"/> </wsdl:message> <wsdl:message name="addBookResponse"> <wsdl:part element="wns:addBookResponse" name="parameters"/> </wsdl:message> <wsdl:portType name="Library"> <wsdl:operation name="getBook"> <wsdl:input message="wns:getBookRequest" name="getBookRequest"/> <wsdl:output message="wns:getBookResponse" name="getBookResponse"/> </wsdl:operation> <wsdl:operation name="getBooksByType"> <wsdl:input message="wns:getBooksByTypeRequest" name="getBooksByTypeRequest"/> <wsdl:output message="wns:getBooksByTypeResponse" name="getBooksByTypeResponse"/> </wsdl:operation> <wsdl:operation name="addBook"> <wsdl:input message="wns:addBookRequest" name="addBookRequest"/> <wsdl:output message="wns:addBookResponse" name="addBookResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="LibrarySoapBinding" type="wns:Library"> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="getBook"> <wsdlsoap:operation soapAction="urn:getBook"/> <wsdl:input name="getBookRequest"> <wsdlsoap:body use="literal"/> </wsdl:input> <wsdl:output name="getBookResponse"> <wsdlsoap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="getBooksByType"> <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" URI="#UsernameToken"/> <wsdlsoap:operation soapAction="urn:getBooksByType"/> <wsdl:input name="getBooksByTypeRequest"> <wsdlsoap:body use="literal"/> </wsdl:input> <wsdl:output name="getBooksByTypeResponse"> <wsdlsoap:body use="literal"/> </wsdl:output> </wsdl:operation> <wsdl:operation name="addBook"> <wsdlsoap:operation soapAction="urn:addBook"/> <wsdl:input name="addBookRequest"> <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" URI="#SignOnly"/> <wsdlsoap:body use="literal"/> </wsdl:input> <wsdl:output name="addBookResponse"> <wsdlsoap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="library-granular"> <wsdl:port binding="wns:LibrarySoapBinding" name="library"> <wsdlsoap:address location="http://localhost:8080/axis2/services/library-granular"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
WSDL2Java.bat -uri ./library.wsdl produces
es/Dennis/src/com/sosnoski/ws/library/wsdl (master)
$ ls -al *.java
-rw-r--r-- 1 mgainty Administ 26464 Nov 10 19:39 AddBook.java
-rw-r--r-- 1 mgainty Administ 17200 Nov 10 21:38 AddBookResponse.java
-rw-r--r-- 1 mgainty Administ 25929 Nov 10 19:37 BookInformation.java
-rw-r--r-- 1 mgainty Administ 9289 Nov 8 19:52 Factory.java
-rw-r--r-- 1 mgainty Administ 16099 Nov 10 19:16 GetBook.java
-rw-r--r-- 1 mgainty Administ 18770 Nov 10 19:18 GetBookResponse.java
-rw-r--r-- 1 mgainty Administ 53875 Nov 10 18:39 GetBooksByResponseType.j
ava
-rw-r--r-- 1 mgainty Administ 15808 Nov 10 19:23 GetBooksByType.java
-rw-r--r-- 1 mgainty Administ 16246 Nov 10 19:21 GetBooksByTypeResponse.j
ava
-rw-r--r-- 1 mgainty Administ 7899 Nov 10 20:44 LibraryGranularCallbackH
andler.java
-rw-r--r-- 1 mgainty Administ 202077 Nov 10 22:00 LibraryGranularStub.java
-rw-r--r-- 1 mgainty Administ 17206 Nov 10 22:13 XMLStreamWriterImpl.java
i birthed out all inner classes as I could'nt tell which factory went with what
class
after 3 days of solid non-stop compiling I get this aar
es/Dennis/target (master)
$ ls -al
total 725
drwxr-xr-x 5 mgainty Administ 0 Nov 10 22:19 classes
-rw-r--r-- 1 mgainty Administ 696066 Nov 10 22:21
library-granular-2.1.6.aar
and i deployed my distro to local repository with this maven pom.xml
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sosnoski</groupId>
<artifactId>library-granular</artifactId>
<version>2.1.6</version>
</project>
so after 3 days of compile torture what do i gain to access Policy Information?
$AXIS2_HOME\core\branches\java\1_3\modules\samples\Dennis>
grep -S -l Policy *.java
.\src\com\sosnoski\ws\library\wsdl\GetBooksByResponseType.java
private static org.apache.neethi.Policy getPolicy (java.lang.String
policyString) {
java.io.ByteArrayInputStream bais = new
java.io.ByteArrayInputStream(policyString.getBytes());
return org.apache.neethi.PolicyEngine.getPolicy(bais);
}
?
Martin
______________________________________________
American Wireshark Operators: do not alter or disrupt this transmission.
Date: Tue, 9 Nov 2010 09:22:13 +1300
From: [email protected]
To: [email protected]
Subject: Re: Axis2 code gen with WS-Policy 1.5?
Another Apache project is using Neethi and has support for WS-Addressing 1.5. I
haven't checked into the details of their implementation, but they're currently
distributing Neethi 2.0.4.
- Dennis
Also looks like its not even supported in Neethi yet .. and is on the roadmap
for Neethi 3.0?
Sanjiva.
On Mon, Nov 8, 2010 at 9:01 PM, Katherine Sanders
<[email protected]> wrote:
Hi Dennis,
I don't think the work has been done to support WS-Policy 1.5 in Axis2 because
the documentation references the older WS-Policy 1.2 specification (see the
resources at the bottom of this page
http://ws.apache.org/axis2/1_5_1/WS_policy.html). Perhaps you could open a
Jira for this feature if you require it.
Thanks,
Katherine
Katherine Sanders
MP 127, IBM UK Ltd
Software Engineer
Hursley Park, Winchester, Hampshire SO21 2JN
WebSphere ESB Foundation Technologies
United Kingdom
IBM Software Group, Application and Integration Middleware Software
Phone:
+44 (0) 1962 815758
Tie-Line:
245758
e-mail:
[email protected]
From: Dennis Sosnoski <[email protected]>
To: [email protected]
Cc: Sanka Samaranayake <[email protected]>
Date: 02/11/2010 21:50
Subject: Re: Axis2 code gen with WS-Policy 1.5?
I've attached one. If you generate from this as supplied (using the submission
namespace) the client stub attaches the appropriate policy to the messages:
(__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicySubject().attachPolicy(getPolicy("<wsp:Policy
wsu:Id=\"UsernameToken\"
xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"
xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"><wsp:ExactlyOne><wsp:All><sp:SupportingTokens
xmlns:sp=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702\"><wsp:Policy><sp:UsernameToken
xmlns:sp=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702\"
sp:IncludeToken=\"http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient\"
/></wsp:Policy></sp:SupportingTokens></wsp:All></wsp:ExactlyOne></wsp:Policy>"));
If you replace all instances of the
http://schemas.xmlsoap.org/ws/2004/09/policy namespace with the
http://www.w3.org/ns/ws-policy namespace and regenerate there's no policy
attached in the stub.
- Dennis
On 11/03/2010 12:35 AM, Sanka Samaranayake wrote: Can you post the WSDL that
you use to generate code ?
Sanka
On Tue, Nov 2, 2010 at 8:57 AM, Dennis Sosnoski <[email protected]> wrote:
Is anyone using WS-Policy 1.5 (the official W3C release,
http://www.w3.org/ns/ws-policy namespace) with Axis2 code generation? It
looks like the policy is silently ignored, so the client gets generated
with no policy attached and there's no security at runtime.
- Dennis
--
Dennis M. Sosnoski
Java SOA and Web Services
Axis2/CXF/Metro Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--
Sanka Samaranayake
PMC Member, Committer, Apache Software Foundation, http://www.apache.org/
Telephone: +34 677 864358
Email: sanka AT apache DOT org
Blog: http://sankas.blogspot.com/
Linked-in: http://lk.linkedin.com/pub/sanka-samaranayake/4/b2b/3b3
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#### library.wsdl moved to MyAttachments Repository V3.8 (Link) on 04 November
2010 by Katherine Sanders.
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
--
Sanjiva Weerawarana, Ph.D.
Founder, Director & Chief Scientist; Lanka Software Foundation;
http://www.opensource.lk/
Founder, Chairman & CEO; WSO2; http://wso2.com/
Founder & Director; Thinkcube Systems; http://www.thinkcube.com/
Member; Apache Software Foundation; http://www.apache.org/
Member; Sahana Software Foundation; http://www.sahanafoundation.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/
Blog: http://sanjiva.weerawarana.org/
<<attachment: ATT00001>>
