[JBossWS] - Re: Custom exception/fault with JBoss & JWSDP
by bernhard_pauler
I tried it - and it worked with the wstools.
BUT ...
Besides the custom exception I have to work with attachments. With the definition of attachments in place I really had a hard time with the wstools. I tried really hard - but I had to step back to the wscompile tool of the JWSDP which just worked without fiddling.
I wanted to solve the custom exception issue though so I investigated once more and compared the generated artifacts/descriptors of the two tools.
And I finally found the difference - it was in the jaxrpc-mapping.xml:
JWSDP - wscompile<root-type-qname xmlns:typeNS="http://myservice.mycompany.com/myservice">typeNS:MyServiceFault</root-type-qname>
JBoss - wstools<anonymous-type-qname xmlns:typeNS="http://myservice.mycompany.com/myservice">typeNS:>MyServiceFault</anonymous-type-qname>
I don't know who to blame. The generated "root-type-qname" tag of the wscompile tool looks fishy if you compare it to the other tags in the same mapping file - and in fact JBoss can't seem to deal with it.
Replace that line with the line the wstools generate and the warnings are gone and the custom exception mechanism is working. :)
That's the solution to my problem now. Not a beautiful solution - but it works and I can't invest more time at the moment. Hope this helps somebody ...
Bernhard
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085744#4085744
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085744
18 years, 1 month
[JBossWS] - Problem with methods returning an attachment
by bernhard_pauler
I have a nasty problem.
Some methods of my web service should return an attachment.
I start with a handwritten WSDL file and generate the necessary artifacts and descriptors using JAX-RPC tools.
There are no warning or error messages at deploy time.
An error occurs after invoking the method:
16:27:34,485 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
org.jboss.ws.WSException: Operation does not have a return value: {http://myservice.mycompany.com/myservice}getTemplate
I can't figure out why JBoss behaves that way - can somebody help me with this?
Thanks,
Bernhard
Here are of the relevant files:
MyService.wsdl:<?xml version="1.0" encoding="utf-8"?>
|
| <definitions name="MyService"
| xmlns ="http://schemas.xmlsoap.org/wsdl/"
| xmlns:soap ="http://schemas.xmlsoap.org/wsdl/soap/"
| xmlns:mime ="http://schemas.xmlsoap.org/wsdl/mime/"
| xmlns:xsd ="http://www.w3.org/2001/XMLSchema"
| xmlns:tns ="http://myservice.mycompany.com/myservice"
| targetNamespace="http://myservice.mycompany.com/myservice">
|
| <types>
| <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://myservice.mycompany.com/myservice">
| <element name="getTemplate">
| <complexType>
| <sequence>
| <element name="templateId" type="xsd:int"/>
| </sequence>
| </complexType>
| </element>
| <element name="MyServiceFault">
| <complexType>
| <sequence>
| <element name="errorCode" type="xsd:string"/>
| <element name="errorMessage" type="xsd:string"/>
| </sequence>
| </complexType>
| </element>
| </schema>
| </types>
|
| <message name="getTemplateRequest">
| <part name="parameters" element="tns:getTemplate"/>
| </message>
| <message name="getTemplateResponse">
| <part name="template" type="xsd:hexBinary"/>
| </message>
| <message name="MyServiceFaultMessage">
| <part name="fault" element="tns:MyServiceFault"/>
| </message>
|
| <portType name="MyServiceEndpoint">
| <operation name="getTemplate">
| <input message="tns:getTemplateRequest"/>
| <output message="tns:getTemplateResponse"/>
| <fault name="MyServiceFault" message="tns:MyServiceFaultMessage"/>
| </operation>
| </portType>
|
| <binding name="MyServiceEndpointBinding" type="tns:MyServiceEndpoint">
| <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
| <operation name="getTemplate">
| <input>
| <soap:body use="literal"/>
| </input>
| <output>
| <mime:multipartRelated>
| <mime:part>
| <soap:body use="literal"/>
| </mime:part>
| <mime:part>
| <mime:content part="template" type="application/*"/>
| </mime:part>
| </mime:multipartRelated>
| </output>
| <fault name="MyServiceFault">
| <soap:fault name="MyServiceFault" use="literal"/>
| </fault>
| </operation>
| </binding>
|
| <service name="MyService">
| <port name="MyServiceEndpointPort" binding="tns:MyServiceEndpointBinding">
| <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
| </port>
| </service>
|
| </definitions>
jaxrpc-mapping.xml:<?xml version="1.0" encoding="UTF-8"?>
| <java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
| <package-mapping>
| <package-type>com.mycompany.myservice</package-type>
| <namespaceURI>http://myservice.mycompany.com/myservice</namespaceURI>
| </package-mapping>
| <java-xml-type-mapping>
| <java-type>com.mycompany.myservice.MyServiceFault</java-type>
| <anonymous-type-qname xmlns:typeNS="http://myservice.mycompany.com/myservice">typeNS:>MyServiceFault</anonymous-type-qname>
| <qname-scope>complexType</qname-scope>
| <variable-mapping>
| <java-variable-name>errorCode</java-variable-name>
| <xml-element-name>errorCode</xml-element-name>
| </variable-mapping>
| <variable-mapping>
| <java-variable-name>errorMessage</java-variable-name>
| <xml-element-name>errorMessage</xml-element-name>
| </variable-mapping>
| </java-xml-type-mapping>
| <java-xml-type-mapping>
| <java-type>com.mycompany.myservice.GetTemplate</java-type>
| <anonymous-type-qname>http://myservice.mycompany.com/myservice:>getTemplate</anonymous-type-qname>
| <qname-scope>complexType</qname-scope>
| <variable-mapping>
| <java-variable-name>templateId</java-variable-name>
| <xml-element-name>templateId</xml-element-name>
| </variable-mapping>
| </java-xml-type-mapping>
| <exception-mapping>
| <exception-type>com.mycompany.myservice.MyServiceFault</exception-type>
| <wsdl-message xmlns:exMsgNS="http://myservice.mycompany.com/myservice">exMsgNS:MyServiceFaultMessage</wsdl-message>
| <constructor-parameter-order>
| <element-name>errorCode</element-name>
| <element-name>errorMessage</element-name>
| </constructor-parameter-order>
| </exception-mapping>
| <service-interface-mapping>
| <service-interface>com.mycompany.myservice.MyService</service-interface>
| <wsdl-service-name xmlns:serviceNS="http://myservice.mycompany.com/myservice">serviceNS:MyService</wsdl-service-name>
| <port-mapping>
| <port-name>MyServiceEndpointPort</port-name>
| <java-port-name>MyServiceEndpointPort</java-port-name>
| </port-mapping>
| </service-interface-mapping>
| <service-endpoint-interface-mapping>
| <service-endpoint-interface>com.mycompany.myservice.MyServiceEndpoint</service-endpoint-interface>
| <wsdl-port-type xmlns:portTypeNS="http://myservice.mycompany.com/myservice">portTypeNS:MyServiceEndpoint</wsdl-port-type>
| <wsdl-binding xmlns:bindingNS="http://myservice.mycompany.com/myservice">bindingNS:MyServiceEndpointBinding</wsdl-binding>
| <service-endpoint-method-mapping>
| <java-method-name>getTemplate</java-method-name>
| <wsdl-operation>getTemplate</wsdl-operation>
| <wrapped-element/>
| <method-param-parts-mapping>
| <param-position>0</param-position>
| <param-type>int</param-type>
| <wsdl-message-mapping>
| <wsdl-message xmlns:wsdlMsgNS="http://myservice.mycompany.com/myservice">wsdlMsgNS:getTemplateRequest</wsdl-message>
| <wsdl-message-part-name>templateId</wsdl-message-part-name>
| <parameter-mode>IN</parameter-mode>
| </wsdl-message-mapping>
| </method-param-parts-mapping>
| <wsdl-return-value-mapping>
| <method-return-value>javax.activation.DataHandler</method-return-value>
| <wsdl-message xmlns:wsdlMsgNS="http://myservice.mycompany.com/myservice">wsdlMsgNS:getTemplateResponse</wsdl-message>
| <wsdl-message-part-name>template</wsdl-message-part-name>
| </wsdl-return-value-mapping>
| </service-endpoint-method-mapping>
| </service-endpoint-interface-mapping>
| </java-wsdl-mapping>
MyServiceEndpoint.java:package com.mycompany.myservice;
|
| public interface MyServiceEndpoint extends java.rmi.Remote {
| public javax.activation.DataHandler getTemplate(int templateId) throws
| com.mycompany.myservice.MyServiceFault, java.rmi.RemoteException;
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085734#4085734
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085734
18 years, 1 month