Re: WS-Eventing extension sends incorrect HTTP content-type
by Dan Retzlaff
My apologies. I should have moved to the trunk. This issue was already
addressed, twice actually. SOAPMessageImpl is now smart enough to
detect 1.2 envelope and use the correct content-type, and Subscription
was changed changed to SOAP 1.1 anyway.
Regards,
Dan
On Jan 17, 2008 12:20 AM, Heiko Braun <hbraun(a)redhat.com> wrote:
>
> Thanks. I've created an ticket for it:
> http://jira.jboss.org/jira/browse/JBWS-1957
>
> If you like, I'd happily accept a patch for this.
>
> /Heiko
>
>
>
> On Wed, 2008-01-16 at 19:30 -0800, Dan Retzlaff wrote:
> > The Subscription class in org.jboss.ws.extensions.eventing.mgmt
> > contains hard-coded SOAP 1.2 envelopes for event notification and
> > SubscriptionEnd messages. However, SOAPConnectionImpl::callOneWay()
> > sets the HTTP content-type to "text/xml". (More specifically,
> > SOAPMessageImpl::saveChanges() does.)
> >
> > The SOAP 1.2 specification (7.1.4) and RFC 3902 require that SOAP HTTP
> > bindings use a content-type of "application/soap+xml".
> >
> > This appears to be a bug. In my case, it manifests itself by when
> > Axis2 throws a SOAPProcessingException complaining that incoming
> > transport level information do not match the SOAP namespace.
> >
> > I would suggest that Subscription provide the correct content-type in
> > a MimeHeaders object to its MessageFactory::createMessage() call, but
> > SOAPMessageImpl::saveChanges() overwrites the value indiscriminately.
> > Is changing those hard-coded envelopes to SOAP 1.1 the best solution
> > here? It seems like we should be able to make SOAP 1.2 work...
> >
> > Regards,
> > Dan
>
>
17 years
[JBossWS] - Re: WS-Security Newbie Question...
by PeterJ
On the client side, you will need the keystore and truststore. You can use the same ones used at the server, but if that it not possible (or not desireable) you will need to do more work with setting up the server keystore and truststore, and also create client keystore and truststore.
When packaging the client, include in the META-INF directory the files:
* client keystore
* client truststore
* jboss-wsse-client.xml (looks like the server one you listed above)
* standard-jaxws-client-config.xml (get it from deploy/jbossws.sar/META-INF, remove all of the client-config entries except the one named "Standard WSSecurity Client")
I can direct you to a location where the steps to do this are documented, but it is not free.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121001#4121001
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121001
17 years
[JBossWS] - unexpected XML reader state
by kosmos
We've generated ws client by means of wxconsume from jbossws-native-2.0.2.GA. Everything looked good, until we got an exception.
| javax.xml.ws.WebServiceException: unexpected XML reader state. expected: END_ELEMENT but found: START_ELEMENT
| at com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder.toInternalMessage(Unknown Source)
| at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.receive(Unknown Source)
| at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(Unknown Source)
| at com.sun.xml.internal.ws.protocol.soap.client.SOAPMessageDispatcher.send(Unknown Source)
| at com.sun.xml.internal.ws.encoding.soap.internal.DelegateBase.send(Unknown Source)
| at com.sun.xml.internal.ws.client.EndpointIFInvocationHandler.implementSEIMethod(Unknown Source)
| at com.sun.xml.internal.ws.client.EndpointIFInvocationHandler.invoke(Unknown Source)
| at $Proxy17.listStudents(Unknown Source)
| at testContingent.main(testContingent.java:32)
| Caused by: unexpected XML reader state. expected: END_ELEMENT but found: START_ELEMENT
| at com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil.verifyReaderState(Unknown Source)
| at com.sun.xml.internal.ws.encoding.soap.SOAPDecoder.decodeBody(Unknown Source)
| at com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder.decodeBody(Unknown Source)
| at com.sun.xml.internal.ws.encoding.soap.client.SOAPXMLDecoder.decodeEnvelope(Unknown Source)
| ... 9 more
|
| public class testContingent {
| public static void main(String[] args) {
| Contingent contingent = new Contingent();
| StudentsSrvPort studentsSrvPort = contingent.getContingentSOAP();
| ObjectFactory of = new ObjectFactory();
| ListStudentsRequest listStudentsRequest = of.createListStudentsRequest();
| listStudentsRequest.setFirstName("");
| listStudentsRequest.setMiddleName("");
| listStudentsRequest.setLastName("");
| listStudentsRequest.setStudentState("");
| listStudentsRequest.setGender("");
| listStudentsRequest.setCardNumber("");
| listStudentsRequest.setDisabled(null);
| listStudentsRequest.setDormitory(null);
| listStudentsRequest.setForeign(null);
| listStudentsRequest.setGroup("5-11");
| try{
| List<Student> studList = new ArrayList<Student>(studentsSrvPort.listStudents(listStudentsRequest).getStudent());
|
| if (studList != null) {
| for (Student stud : studList){
| System.out.println(new String((stud.getId()+" "+stud.getName()).getBytes("UTF8")));
| }
| }
| } catch (WebServiceException e) {
| e.printStackTrace();
| } catch (UnsupportedEncodingException e) {
| e.printStackTrace();
| }
| }
| }
|
Here is our POST
| POST /SOAP HTTP/1.1
| Content-Length: 501
| SOAPAction: "http://contingent.bmstu.ru/listStudents"
| Accept: text/xml, application/xop+xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
| Content-Type: text/xml; charset=utf-8
| User-Agent: Java/1.6.0_01
| Host: contingent.bmstu.ru:144
| Connection: keep-alive
|
| <?xml version="1.0" ?>
| <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://contingent.bmstu.ru/">
| <soapenv:Body>
| <ns1:listStudentsRequest>
| <ns1:lastName></ns1:lastName>
| <ns1:firstName></ns1:firstName>
| <ns1:middleName></ns1:middleName>
| <ns1:group>5-11</ns1:group>
| <ns1:gender></ns1:gender>
| <ns1:cardNumber></ns1:cardNumber>
| <ns1:studentState></ns1:studentState>
| </ns1:listStudentsRequest>
| </soapenv:Body>
| </soapenv:Envelope>
|
And server's response
| HTTP/1.1 200
| Server: nginx/0.5.20
| Date: Thu, 17 Jan 2008 13:53:35 GMT
| Content-Type: text/xml; charset=utf-8
| Connection: keep-alive
| Content-length: 38923
|
| <?xml version='1.0'?>
| <soapenv:Envelope xmlns:ns1='http://contingent.bmstu.ru/'
| xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
| xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
| xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <soapenv:Body>
| <listStudentsResponse xsi:type='ns1:listStudentsResponse'>
| <student xsi:type='ns1:Student'>
| <id>67b8a137-8636-4c20-9649-00000001b583</id>
| <name>xxx xxx xxx</name>
| <firstName>xxx</firstName>
| <middleName>xxx</middleName>
| <lastName>xxx</lastName>
| <gender xsi:type='ns1:Classifier'>
| <id>2c4fdb64-0c14-4dd1-81c1-000000000001</id>
| <name>xxx</name>
| </gender>
| <cardNumber>07ã024</cardNumber>
| <studyType xsi:type='ns1:Classifier'>
| <id>f3fd113a-e251-4816-b411-000000000001</id>
| <name>xxx</name>
| </studyType>
| <studentState xsi:type='ns1:Classifier'>
| <id>9e32657c-61c5-4e58-8ca6-000000000002</id>
| <name>xxx</name>
| </studentState>
| <dormitory>false</dormitory>
| <group xsi:type='ns1:Group'>
| <id>e3664f92-3b36-430e-a638-000000001afa</id>
| <name>5-11</name>
| </group>
| <profession xsi:type='ns1:ProfessionClassifier'>
| <id>ffffffff-ffff-ffff-ffff-ffffffffffff</id>
| <professionCode>230102</professionCode>
| <specializationCode>00</specializationCode>
| <qualificationCode>65</qualificationCode>
| </profession>
| <disabled>false</disabled>
| <foreign>false</foreign>
| <militaryState xsi:type='ns1:Classifier'>
| <id>a6d7fb86-4925-4aed-89bf-000000000000</id>
| <name/>
| </militaryState>
| </student>
| </listStudentsResponse>
| </soapenv:Body>
| </soapenv:Envelope>
|
That looks like a bug.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120895#4120895
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120895
17 years
[JBossWS] - How can I see the SoapResponse
by Vincent321
Hello,
I generated a client with WSConsume and register a handler to log soap messages.
The handler gets called and display the request but I am not able to see either the soapfault nor the soapresponse.
Here is the code of my handler. Could you pls tell me what did I wrong ?
| final String HANDLER_NAME = "LogHandler";
| // change this to redirect output if desired
| private static PrintStream out = System.out;
|
|
|
| public boolean handleMessage(SOAPMessageContext smc) {
| System.out.println("Executing " + HANDLER_NAME);
| logToSystemOut(smc);
| return false;
| }
|
| public boolean handleFault(SOAPMessageContext smc) {
| System.out.println("Une faute");
| logToSystemOut(smc);
| return false;
| }
|
| // nothing to clean up
| public void close(MessageContext messageContext) {
| }
|
| /*
| * Check the MESSAGE_OUTBOUND_PROPERTY in the context
| * to see if this is an outgoing or incoming message.
| * Write a brief message to the print stream and
| * output the message. The writeTo() method can throw
| * SOAPException or IOException
| */
| private void logToSystemOut(SOAPMessageContext smc) {
| Boolean outboundProperty = (Boolean)
| smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
|
| if (outboundProperty) {
| out.println("\nOutbound message:");
| } else {
| out.println("\nInbound message:");
| }
|
| SOAPMessage message = smc.getMessage();
| try {
| message.writeTo(out);
| out.println(""); // just to add a newline
| } catch (Exception e) {
| out.println("Exception in handler: " + e);
| }
| }
|
Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120887#4120887
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120887
17 years
[JBossWS] - Re: WS-Security Newbie Question...
by lafaserem
Alessio.. yes... I've already read that link. Thanks anyway ;)
Peter.. Also I've already read that post, but I'm still lost (sorry.. these are my first days working with web services and I'm getting a bit crazy hehe)
I'm gonna write everything I'm doing (surely there will be a lot of mistakes, but well.. all the beginnings are tough... :P) and I would appreciate a lot if you could give me a hand in this...
First... SERVER
Hello.java
| package wssec;
|
| import javax.jws.WebMethod;
| import javax.jws.WebParam;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
|
| import org.jboss.ws.annotation.EndpointConfig;
|
| @WebService(name = "Hello", targetNamespace = "urn:ws.sec")
| @EndpointConfig(configName = "Standard WSSecurity Endpoint")
| @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
| public class Hello
| {
| @WebMethod
| public String echo(@WebParam(name = "param1") String param1)
| {
| return param1;
| }
| }
|
I compiled it with
| javac -d . -classpath jboss-jaxws.jar;jboss-client.jar *.java
|
I've made my keystore with the command:
| keytool -genkey -keystore wsse.keystore -storepass jbossws -keyalg RSA -alias wsse -validity 365
|
Then I exported the certificate with:
| keytool -export -file wsse.cer -keystore wsse.keystore -storepass jbossws -alias wsse
|
And created the truststore with
| keytool -import -alias wsse -file wsse.cer -keystore wsse.truststore -storepass jbossws
|
web.xml
| <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
| version="2.4">
| <display-name>Hello</display-name>
| <servlet>
| <servlet-name>Hello</servlet-name>
| <servlet-class>wssec.Hello</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>Hello</servlet-name>
| <url-pattern>/Hello</url-pattern>
| </servlet-mapping>
| </web-app>
|
jboss-wsse-server.xml
| <?xml version="1.0" encoding="UTF-8"?>
|
| <jboss-ws-security xmlns="http://www.jboss.com/ws-security/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://www.jboss.com/ws-security/config http://www.jboss.com/ws-security/schema/jboss-ws-security_1_
| 0.xsd">
| <key-store-file>WEB-INF/wsse.keystore</key-store-file>
| <key-store-password>jbossws</key-store-password>
| <trust-store-file>WEB-INF/wsse.truststore</trust-store-file>
| <trust-store-password>jbossws</trust-store-password>
| <config>
| <sign type="x509v3" alias="wsse"/>
| <requires>
| <signature/>
| </requires>
| </config>
| </jboss-ws-security>
|
I create my .war with
| jar cvf Hello.war WEB-INF
|
and the structure of WEB-INF is
WEB-INF
| jboss-wsse-server.xml
| wsse.keystore
| wsse.truststore
| web.xml
| classes
| | Hello.class
Once done this I copy Hello.war into jboss4-2-2GA\server\default\deploy and everything seems to be OK
Once that I have the WS deployed on the server which are the steps I have to follow for build my client? I only want to transmit signed messages, not interested in encryption...
This might seem a stupid topic, but I'm getting lost, 'cause this is new for me and I'm not able to find any "very very very basic" documents...
Thanks ;)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120850#4120850
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120850
17 years
[JBossWS] - Re: Jsr181 typenamespace specification.
by fdifonzo
Hi,
Unfortunately annotation on my custom type doesn't take any effect (I'm using jboss 4.2.2).
My custom type looks like this now:
package mycompany.exception;
|
| import java.io.Serializable;
|
| import javax.xml.bind.annotation.XmlAccessType;
| import javax.xml.bind.annotation.XmlAccessorType;
| import javax.xml.bind.annotation.XmlElement;
| import javax.xml.bind.annotation.XmlRootElement;
| import javax.xml.bind.annotation.XmlType;
|
| @XmlAccessorType(XmlAccessType.FIELD)
| @XmlType(name = "AlreadyExistsDeviceException", namespace="http://mycompany/types", propOrder = {
| "errorMessage"
| })
| public class AlreadyExistsDeviceException extends Exception
| implements Serializable {
| @XmlElement(required = true, nillable = true)
| private String errorMessage;
|
|
| public AlreadyExistsDeviceException(String errorMsg) {
|
| super(errorMsg);
|
| this.errorMessage = errorMsg;
|
| }
|
| public String getErrorMessage() {
|
| return errorMessage;
|
| }
|
| }
While my endpoint looks like the following:
package mycompany;
| .....
| .....
|
| @Stateless
| @Remote(WEBServiceRemote.class)
| @WebService(name = "EndPointInterface", targetNamespace = "http://mycompany", serviceName = "MyServiceWEBService")
| @SOAPBinding(style = SOAPBinding.Style.RPC)
| @XmlSeeAlso({mycompany.exception.AlreadyExistsDeviceException.class)
| public class WEBServiceBean implements WEBServiceRemote, CodeControl {
|
|
| @WebMethod
| public void addDevice(String id, String type, String path) throws AlreadyExistsDeviceException {
| ......
| ......
| }
|
| }
Using wsdl-tool I get a wsdl looking ike this:
| .....
| .....
| <types>
| .....
| .....
| <schema targetNamespace='http://mycompany/types' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns2='http://lang.java/' xmlns:ns3='
| http://annotation.lang.java/' xmlns:ns4='http://reflect.lang.java/' xmlns:ns5='http://security.java/' xmlns:ns6='http://cert.security.java/' xmlns:ns7='http
| ://www.w3.org/2001/XMLSchema' xmlns:ns8='http://util.java/' xmlns:ns9='http://net.java/' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:
| tns='http://webservice.ztc.alliedtelesyn.com/types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
| <import namespace='http://annotation.lang.java/'/>
| <import namespace='http://cert.security.java/'/>
| <import namespace='http://net.java/'/>
| <import namespace='http://util.java/'/>
| <import namespace='http://www.w3.org/2001/XMLSchema'/>
| <import namespace='http://reflect.lang.java/'/>
| <import namespace='http://lang.java/'/>
| <import namespace='http://security.java/'/>
| <complexType name='AlreadyExistsDeviceException'>
| <sequence>
| <element name='errorMessage' nillable='true' type='string'/>
| </sequence>
| </complexType>
| .....
| .....
| </types>
| .......
| .......
|
While using annotation approach, I'm continuing getting the following wsdl:
....
| ....
| <types>
| .....
| .....
| <xs:complexType name="AlreadyExistsDeviceException">
| <xs:sequence>
| <xs:element minOccurs="0" name="errorMessage" type="xs:string"/>
| <xs:element minOccurs="0" name="message" type="xs:string"/>
| </xs:sequence>
| </xs:complexType>
| .....
| .....
| </types>
| ....
| ....
Note that there's no namespace in the latter. Is there a way to discover what wrong is on my code? I set log4j debug level to TRACE but I haven't seen any Error.
Any help will be really appreciated.
Thanks a lot, Fabrizio
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120839#4120839
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120839
17 years