[JBossWS] - Raw Style webservices [Design question]
by viniciuscarvalho
Hello there! I'm developing a Topdown webservice, and defining my own WSDL, and using @WebserviceProvider annotations.
The service is running, I can access it using webservice explorer or SOAPUI. When I generate the client using JBoss WS, I'm getting some errors on the response. I know it's something related to my WSDL, and SOAP response. So I was hopping someone could assist me:
WSDL
| <?xml version="1.0" encoding="UTF-8" standalone="no"?>
| <wsdl:definitions
| xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
| xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
| xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
| xmlns:sys="http://www.acme.com/schemas/sys"
| targetNamespace="http://www.acme.com/sys/definitions"
| xmlns:tns="http://www.acme.com/sys/definitions">
| <wsdl:types>
| <xsd:schema>
| <xsd:import namespace="http://www.acme.com/schemas/sys" schemaLocation="Command.xsd" id="sys"/>
| </xsd:schema>
|
| </wsdl:types>
|
| <wsdl:message name="CommandRequest">
| <wsdl:part name="parameters" element="sys:anyCommand"></wsdl:part>
| </wsdl:message>
| <wsdl:message name="CommandResponse">
| <wsdl:part name="return" element="sys:CommandResponse"></wsdl:part>
| </wsdl:message>
|
| <wsdl:portType name="CommandProcessorPortType">
| <wsdl:operation name="process">
| <wsdl:input message="tns:CommandRequest" name="CommandRequestInput"></wsdl:input>
| <wsdl:output message="tns:CommandResponse" name="CommandResponseOutput"></wsdl:output>
| </wsdl:operation>
| </wsdl:portType>
|
| <wsdl:binding name="CommandProcessorBinding" type="tns:CommandProcessorPortType">
| <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
| <wsdl:operation name="process">
| <soap:operation soapAction="http://www.acme.com/sys/CommandRequest"/>
| <wsdl:input>
| <soap:body use="literal"/>
| </wsdl:input>
| <wsdl:output>
| <soap:body use="literal"/>
| </wsdl:output>
| </wsdl:operation>
| </wsdl:binding>
|
| <wsdl:service name="CommandProcessorService">
| <wsdl:port name="CommandProcessorPort" binding="tns:CommandProcessorBinding">
| <soap:address location="http://localhost:8080/CommandProcessorService"/>
| </wsdl:port>
| </wsdl:service>
| </wsdl:definitions>
|
|
Command.xsd
| <?xml version="1.0" encoding="UTF-8"?>
| <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
| targetNamespace="http://www.acme.com/schemas/sys"
| xmlns:sys="http://www.acme.com/schemas/sys"
| elementFormDefault="qualified">
|
| <xsd:element name="anyCommand">
| <xsd:complexType>
| <xsd:sequence>
| <xsd:any minOccurs="1"></xsd:any>
| </xsd:sequence>
| </xsd:complexType>
| </xsd:element>
|
| <xsd:element name="CommandResponse">
| <xsd:complexType>
| <xsd:sequence>
| <xsd:element name="return" type="sys:ResponseCommandType"></xsd:element>
| </xsd:sequence>
| </xsd:complexType>
| </xsd:element>
|
|
|
| <xsd:complexType name="ResponseCommandType">
| <xsd:sequence>
| <xsd:element name="id" type="xsd:long"></xsd:element>
| <xsd:element name="message" type="xsd:string"></xsd:element>
| </xsd:sequence>
| </xsd:complexType>
| </xsd:schema>
|
My Provider
|
| @Local
| @Stateless
| @WebServiceProvider(wsdlLocation="META-INF/wsdl/CommandProcessor.wsdl",
| targetNamespace="http://www.acme.com/sys/definitions",
| serviceName="CommandProcessorService",
| portName="CommandProcessorPort")
| @ServiceMode(value=Service.Mode.PAYLOAD)
| public class CommandProcessor implements Provider<Source> {
| Source returnMessage;
| public Source invoke(Source messge) {
|
| DOMSource domSource = null;
|
| try {
| Transformer transformer = TransformerFactory.newInstance().newTransformer();
| transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
| transformer.setOutputProperty(OutputKeys.METHOD, "xml");
| OutputStream out = new ByteArrayOutputStream();
| StreamResult streamResult = new StreamResult();
| streamResult.setOutputStream(out);
| transformer.transform(messge, streamResult);
| String xmlReq = streamResult.getOutputStream().toString();
| System.out.println(xmlReq);
| domSource = new DOMSource(createResponseContent());
| transformer.transform(domSource, streamResult);
| xmlReq = streamResult.getOutputStream().toString();
| System.out.println(xmlReq);
| } catch (Exception e) {
| // TODO Auto-generated catch block
| e.printStackTrace();
| }
| return domSource;
| }
|
| private Document createResponseContent() throws Exception{
| DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
| dbf.setNamespaceAware(true);
| DocumentBuilder db = dbf.newDocumentBuilder();
| Document doc = db.newDocument();
| Element responseCommand = doc.createElementNS("http://www.acme.com/sys/definitions", "sys:CommandResponse");
| Element ret = doc.createElement("return");
| Element id = doc.createElement("id");
| id.appendChild(doc.createTextNode("1"));
| Element message = doc.createElement("message");
| message.appendChild(doc.createTextNode("comando recebido"));
| ret.appendChild(id);
| ret.appendChild(message);
| responseCommand.appendChild(ret);
| doc.appendChild(responseCommand);
| return doc;
| }
|
| }
|
Well, first, when I run ws-provide it throws a lot of warnings on the console, but it seems that all artifacts are created (Port,Service,Bindings,ObjectFactory).
Ok, running using soap ui:
| Request:
|
| <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sys="http://www.acme.com/schemas/sys">
| <soapenv:Header/>
| <soapenv:Body>
| <csm:anyCommand>
| <asteriskCommand>
| <voip>true</voip>
| </asteriskCommand>
| </csm:anyCommand>
| </soapenv:Body>
| </soapenv:Envelope>
|
| Response:
|
| <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
| <env:Header/>
| <env:Body>
| <sys:CommandResponse xmlns:sys="null">
| <return>
| <id>1</id>
| <message>comando recebido</message>
| </return>
| </csm:CommandResponse>
| </env:Body>
| </env:Envelope>
|
Now, the odd thing, is that the xmlns:sys is null, when I print it on the serverside it displays that the xmlns:sys is pointing to the namespace.
So I run this test with the generated client proxy, and I get an error:
Caused by: org.jboss.ws.WSException: Cannot find child element: {http://www.acme.com/schemas/sys}CommandResponse
I really don't know if this is caused because the xmlns is being returned null, and if so, why? Or did I messed the whole doc/literal wrapped/bare style? I was thinking that I was using bare style :)
Any help would be great :)
Regards
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091226#4091226
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091226
18Â years, 6Â months
[JBoss jBPM] - Re: async processes : favour termination instead of inceptio
by gogoasa
Jeff, if I understand correctly the difference between my installation and yours is that I use the JMS system for async execution while you use the built-in database-based messaging system.
For what it's worth, in my case I don't feel the need to use asynchronous continuations because of parallel processing (the multithreading is done by the app server and I can start multiple process instances in parallel) -- but because, having a series of nodes that take a long time to execute, I need to have shorter, one-node transactions so that in a web console I can have the status of the process. I only use async for shorter transactions around each node and I must say that I would find it very useful if jBPM did its database access behind a RequiresNew EJB (in "enterprise" deployment). That would allow people to have long-taking series of nodes in non-async processes.
Ok, as to the solution, I added an attribute to node :
| <node name="1st-slow-node" async="true" async-priority="1">
| ...
| </node>
| <node name="2nd-slow-node" async="true" async-priority="2">
| ...
| </node>
| <node name="3rd-slow-node" async="true" async-priority="3">
| ...
| </node>
| <node name="4th-slow-node" async="true" async-priority="4">
| ...
| </node>
|
and a field to Node.java :
protected int asyncPriority;
and the corresponding mapping to the Hibernate file.
When a Jms message is sent, its priority is sent using the node attribute.
I haven't checked, but I suppose this should work in your case too, by simply changing the HQL query to do a join with Node and order by node.asyncPriority.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091225#4091225
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091225
18Â years, 6Â months
[JBoss Seam] - Maven Dependency Profiles
by wesleyhales
Great news about the move toward maven!... I'm trying to setup a project using the dependency profiles. If I understand correctly from the readme.txt file in profiles, all one would have to do is:
|
| <dependency>
| <groupId>org.jboss.seam.profile.functional</groupId>
| <artifactId>seam-ui-facelets</artifactId>
| </dependency>
|
| <dependency>
| <groupId>org.jboss.seam.profile.functional</groupId>
| <artifactId>seam-security-all</artifactId>
| </dependency>
|
|
in the pom and all jars/dependencies should be added into the project. Also, I made the root.pom.xml my parent and snapshots.jboss.org/maven2 is my repo. The dependencies can't be found and nothing gets downloaded, am I missing anything?
One other thought for the overall design of the profiles - for Tomcat+EJB vs. JBoss, you will have drools and jbpm in the war for Tomcat and in the root of the ear for Jboss. JSF RI won't be included for JBoss (normally) and will be for Tomcat. With all the mixing and matching for the 2 containers it seems that it may be better to have a division in the profiles or actually use the profile section of the pom for organizing of what you have already created. Just an idea...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091223#4091223
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091223
18Â years, 6Â months