You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by callagc4 <ca...@fineos.com> on 2008/02/23 14:00:20 UTC

MTOM defintition in wsdl


Hi,

I am trying to define a simple service which will simply send binary data. I
will to use MTOM with Axis2. I have read the documentation at
http://ws.apache.org/axis2/1_3/mtom-guide.html. This states two approaches
to defining the xsd schema type for an MTOM element:

1) Quote from documentation : 
You can define a binary element in the schema using the schema
type="xsd:base64Binary". Having an element with the type "xsd:base64Binary"
is enough for the Axis2 code generators to identify possible MTOM
attachments, and to generate code accordingly.

I have defined this in my schema but when i have generated the code Axis2
does not seem to have generated appropriate code for the type. I have set
the enableMTOM property on the client but when the message is sent it is
sent as a standard soap message with the base64binary information sent
within the message instead of as an MTOM attachment. On debugging the client
send, when i create the envelope and add the binary element it calls the
optimizeContent() method to check if the type should be sent at optimized
content, however the opNameArray on the stub is null and so it is not
flagged for optimization.

Is this an issue with the generator? Why does it not add the qname of my
binary element to the opNameArray?

2) the second approach outlined in the documentation states:
Going a little further, you can use the xmime schema
(http://www.w3.org/2005/05/xmlmime) to describe the binary content more
precisely

However this requires import the http://www.w3.org/2005/05/xmlmime namespace
which fails inside our firewall with the following exception:

Retrieving schema at 'http://www.w3.org/2005/05/xmlmime', relative to
'file:/E:/Sandboxes/ProductServices-220208/src/com/fineos/frontoffice/documentproduction/DocumentProductionOperationsXSD/DocumentProductionOperations.xsd'.
Exception in thread "main"
org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL
	at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:150)
	at org.apache.axis2.wsdl.WSDL2Code.main(WSDL2Code.java:35)
	at org.apache.axis2.wsdl.WSDL2Java.main(WSDL2Java.java:24)
Caused by: javax.wsdl.WSDLException: WSDLException (at
/wsdl:definitions/wsdl:types/xsd:schema/xsd:schema): faultCode=OTHER_ERROR:
An error occurred trying to resolve schema referenced at
'http://www.w3.org/2005/05/xmlmime', relative to
'file:/E:/Sandboxes/ProductServices-220208/src/com/fineos/frontoffice/documentproduction/DocumentProductionOperationsXSD/DocumentProductionOperations.xsd'.:
java.net.NoRouteToHostException: No route to host: connect
	at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
	at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.readInTheWSDLFile(CodeGenerationEngine.java:286)
	at
org.apache.axis2.wsdl.codegen.CodeGenerationEngine.<init>(CodeGenerationEngine.java:105)
	... 2 more
Caused by: java.net.NoRouteToHostException: No route to host: connect
	at java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
	at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
	at java.net.Socket.connect(Socket.java:519)
	at java.net.Socket.connect(Socket.java:469)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:382)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:509)
	at sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
	at sun.net.www.http.HttpClient.New(HttpClient.java:304)
	at sun.net.www.http.HttpClient.New(HttpClient.java:316)
	at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:817)
	at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:769)
	at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:694)
	at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:938)
	at java.net.URL.openStream(URL.java:1007)
	at com.ibm.wsdl.util.StringUtils.getContentAsInputStream(Unknown Source)
	... 12 more


wsdl def:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
   
xmlns:operationtypes="http://www.fineos.com/frontoffice/documentproduction/operationtypes"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
	xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
	xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
	xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" 
	xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

targetNamespace="http://www.fineos.com/frontoffice/documentproduction/operationtypes">
    <wsdl:types>
		<xsd:schema
targetNamespace="http://www.fineos.com/frontoffice/documentproduction/operationtypes">
	    	<xsd:include
schemaLocation="../../documentproduction/DocumentProductionOperationsXSD/DocumentProductionOperations.xsd"/>		    
		</xsd:schema>
    </wsdl:types>
    <wsdl:message name="uploadFileRequest">
        <wsdl:part name="parameters" element="operationtypes:uploadFile"/>
    </wsdl:message>
    <wsdl:message name="uploadFileResponse">
        <wsdl:part name="parameters"
element="operationtypes:uploadFileResponse"/>
    </wsdl:message>
    <wsdl:portType name="DocProdServicesPortType">
        <wsdl:operation name="uploadFile">
            <wsdl:input message="operationtypes:uploadFileRequest"
wsaw:Action="urn:uploadFile"/>
            <wsdl:output message="operationtypes:uploadFileResponse"
wsaw:Action="urn:uploadFileResponse"/>            
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="DocProdServicesSOAP11Binding"
type="operationtypes:DocProdServicesPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
        <wsdl:operation name="uploadFile">
            <soap:operation soapAction="urn:uploadFile" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="DocProdServicesSOAP12Binding"
type="operationtypes:DocProdServicesPortType">
        <wsdl:operation name="uploadFile">
            <soap12:operation soapAction="urn:uploadFile" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="DocProdServicesHttpBinding"
type="operationtypes:DocProdServicesPortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="uploadFile">
            <http:operation location="DocProdServices/uploadFile"/>
            <wsdl:input>
                <mime:content type="text/xml" part="uploadFile"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="uploadFile"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="DocProdServices">
        <wsdl:port name="DocProdServicesSOAP11port_http"
binding="operationtypes:DocProdServicesSOAP11Binding">
            <soap:address
location="http://localhost:8080/axis2/service/DocProdServices"/>
        </wsdl:port>
        <wsdl:port name="DocProdServicesSOAP12port_http"
binding="operationtypes:DocProdServicesSOAP12Binding">
            <soap12:address
location="http://localhost:8080/axis2/service/DocProdServices"/>
        </wsdl:port>
        <wsdl:port name="DocProdServicesHttpport"
binding="operationtypes:DocProdServicesHttpBinding">
            <http:address
location="http://localhost:8080/axis2/service/DocProdServices"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>


xsd def:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	attributeFormDefault="unqualified" elementFormDefault="unqualified" 

targetNamespace="http://www.fineos.com/frontoffice/documentproduction/operationtypes">	
	
     <xsd:element name="uploadFile">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element minOccurs="0" name="encodedFile"
nillable="true" type="xsd:base64Binary" />
                <xsd:element minOccurs="0" name="parentDirName"
nillable="true" type="xsd:string" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
     <xsd:element name="uploadFileResponse">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element minOccurs="0" name="return" nillable="true"
type="xsd:string" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

Any help you be appreciated

Thanks,
Cathal




-- 
View this message in context: http://www.nabble.com/MTOM-defintition-in-wsdl-tp15651799p15651799.html
Sent from the Axis - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org