[JBossWS] - Re: How to register SerializerFactory and DeSerializerFactor
by thomas.diesler@jboss.com
This change might work for you
|
| public EncodedTypeMapping()
| {
| registerStandardLiteralTypes();
| registerStandardSOAP11EncodedTypes();
|
| // register mapping for xsd:anyType
| register(SOAPElement.class, Constants.TYPE_LITERAL_ANYTYPE, new SOAPElementSerializerFactory(), new SOAPElementDeserializerFactory());
| register(Element.class, Constants.TYPE_LITERAL_ANYTYPE, new ElementSerializerFactory(), new ElementDeserializerFactory());
|
| // register mapping for soap11-enc:anyType
| register(SOAPElement.class, Constants.TYPE_SOAP11_ANYTYPE, new SOAPElementSerializerFactory(), new SOAPElementDeserializerFactory());
| register(Element.class, Constants.TYPE_SOAP11_ANYTYPE, new ElementSerializerFactory(), new ElementDeserializerFactory());
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033019#4033019
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033019
17 years, 7 months
[JBossWS] - Name of generated exception class
by magnus.ahlander
In my endpoint implementation I have a user-defined exception thrown by some operations. The generated wsdl then looks something like:
...
| <xs:complexType name='AuthorizationException'>
| <xs:sequence>
| <xs:element minOccurs='0' name='message' type='xs:string'/>
| </xs:sequence>
| </xs:complexType>
| ...
| <operation name='read'>
| ...
| <fault name='AuthorizationException'>
| <soap:fault name='AuthorizationException' use='literal'/>
| </fault>
| </operation>
| ...
>From this wsdl wsconsume generates the following client-side artifacts:
AuthorizationException (jaxb type)
AuthorizationException_Exception (java exception)
In the client I then I then get some awkward code like
try {...}
| catch (AuthorizationException_Exception ex) {...}
To get around these problems I defined a custom jax-ws binding, which is then provided to wsconsume:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
| <bindings
| xmlns:xsd="http://www.w3.org/2001/XMLSchema"
| xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
| xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
| wsdlLocation="http://localhost:8080/static/test.wsdl"
| xmlns="http://java.sun.com/xml/ns/jaxws">
| <bindings node="wsdl:definitions">
| <package name="com.test"/>
| </bindings>
| <bindings node="wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='http://com.test']">
| <jaxb:schemaBindings>
| <jaxb:package name="com.test.jaxb"/>
| </jaxb:schemaBindings>
| </bindings>
| </bindings>
basically this puts jaxws and jaxb generated artifacts into separate packages.
However, this works only if I remove the 'package' attribute from the wsconsume task. From this I conclude that the 'package' attribute takes precedence over any custom bindings. Why is this so?
Is there any other way to get nice exception class names with wsconsume?
Regards,
Magnus
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033007#4033007
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033007
17 years, 7 months
[JBossWS] - Re: WS-Security: keystores and truststores
by PeterJ
Another question. Let's say that Bob runs the web service and Alice has a client that uses the web service. Now John would also like to use the web service. John would create:
johns.keystore
----------------
john - keyPair (pub+priv)
bob - trustedCertEntry (pub)
johns.truststore
----------------
john - trustedCertEntry (just john's public key)
In addition, Bob's keystore would be updated to:
bobs.keystore
----------------
bob - keyPair (public + private key)
alice - trustedCertEntry (just alice's public key)
john - trustedCertEntry (just john's public key)
This does not pose a problem for encrypting the request from the client side since both Alice and John use Bob's public key to encrypt the message, and Bob of course uses his pirvate key to decrypt the message. But how is the response message encrypted? Bob would have to know who he is responding to and encrypt accordingly, but how would one specify this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032946#4032946
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032946
17 years, 7 months
[JBossWS] - Re: WS-Security: keystores and truststores
by PeterJ
Thanks again, Jason. I tried this for encryption (and your suggested additions to support signing by updating both truststores so that they contain both public keys) and it worked. I think I now have a little better understanding of the role of the truststore in this scheme.
For those of you following along at home (or at work), when Bob sends a message he uses Alice's key to encrypt the message but his key to sign it, so the config section of jboss-wsse-xxx.xml file looks like:
<config>
| <sign type="x509v3" alias="bobs_key"/>
| <encrypt type="x509v3" alias="alices_key"/>
| <requires>
| <signature />
| <encryption/>
| </requires>
| </config>
Of course, on Alice's machine, the aliases are the opposite. If you don't want to sign the messages, remove the < sign > and < signature/ > tags.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032911#4032911
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032911
17 years, 7 months
[JBossWS] - Re: How to register SerializerFactory and DeSerializerFactor
by czhao07
I think I found the problem. The web service I need to call uses soap encoding style (http://schemas.xmlsoap.org/soap/encoding/), hence EncodedTypeMapping is used which registers type mapping for xsd:anyType as this:
// register mapping for xsd:anyType
registerInternal(SOAPElement.class, Constants.TYPE_SOAP11_ANYTYPE, new SOAPElementSerializerFactory(), new SOAPElementDeserializerFactory());
registerInternal(Element.class, Constants.TYPE_SOAP11_ANYTYPE, new ElementSerializerFactory(), new ElementDeserializerFactory());
In above code, it registers (De)SerializerFactory for a wrong QName. While the fix in LiteralTypeMapping is correct:
// register mapping for xsd:anyType
registerInternal(SOAPElement.class, Constants.TYPE_LITERAL_ANYTYPE, new SOAPElementSerializerFactory(), new SOAPElementDeserializerFactory());
registerInternal(Element.class, Constants.TYPE_LITERAL_ANYTYPE, new ElementSerializerFactory(), new ElementDeserializerFactory());
So I think the above lines of code should be moved to TypeMappingImpl.registerStandardLiteralTypes() in order to fix the problem with both literal and soap encoding styles.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032888#4032888
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032888
17 years, 7 months