2 Replies Latest reply on Mar 4, 2009 1:11 PM by ianashley

    WSDL - convert to MTOM

    ianashley

      What is the best way to convert the code generated by WSConsume to support MTOM transfers of the base64Binary elements?

      Is there a recipe anywhere?

        • 1. Re: WSDL - convert to MTOM
          ianashley

          To provide a bit more information we are used complex types containing base64Binary encoded data, for example

          <s:element name="StoreAsset">
           <s:complexType>
           <s:sequence>
           <s:element minOccurs="1" maxOccurs="1" name="sessionId" type="s:string"/>
           <s:element minOccurs="0" maxOccurs="1" name="assetRef" type="s:string"/>
           <s:element minOccurs="0" maxOccurs="1" name="nodeRef" type="s:string"/>
           <s:element minOccurs="0" maxOccurs="1" name="leafName" type="s:string"/>
           <s:element minOccurs="0" maxOccurs="unbounded" name="values" type="tns:NameTypeValue"/>
           <s:element minOccurs="1" maxOccurs="1" name="asset" type="s:base64Binary"/>
           </s:sequence>
           </s:complexType>
           </s:element>
          


          The generated interface is
          /**
           *
           * @param asset
           * @param values
           * @param assetRef
           * @param leafName
           * @param sessionId
           * @param nodeRef
           * @throws SessionExpiredException
           * @throws NsteinDPSErrorException
           */
           @WebMethod(operationName = "StoreAsset", action = "StoreAsset")
           @RequestWrapper(localName = "StoreAsset", targetNamespace = "http://services.nstein.com/NsteinDPS", className = "com.nstein.services.nsteindps.StoreAsset")
           @ResponseWrapper(localName = "StoreAssetResponse", targetNamespace = "http://services.nstein.com/NsteinDPS", className = "com.nstein.services.nsteindps.StoreAssetResponse")
           public void storeAsset(
           @WebParam(name = "sessionId", targetNamespace = "http://services.nstein.com/NsteinDPS")
           String sessionId,
           @WebParam(name = "assetRef", targetNamespace = "http://services.nstein.com/NsteinDPS", mode = WebParam.Mode.INOUT)
           Holder<String> assetRef,
           @WebParam(name = "nodeRef", targetNamespace = "http://services.nstein.com/NsteinDPS")
           String nodeRef,
           @WebParam(name = "leafName", targetNamespace = "http://services.nstein.com/NsteinDPS")
           String leafName,
           @WebParam(name = "values", targetNamespace = "http://services.nstein.com/NsteinDPS")
           List<NameTypeValue> values,
           @WebParam(name = "asset", targetNamespace = "http://services.nstein.com/NsteinDPS")
           byte[] asset)
           throws NsteinDPSErrorException, SessionExpiredException
           ;
          

          I believe that byte[] asset needs to be changed to DataHandler asset but doing this alone doesn't seem to work.

          Any pointers as to what else is required or link to an example would be very helpful.

          Thanks in advance,
          Ian

          • 2. Re: WSDL - convert to MTOM
            ianashley

            Finally cracked it.

            Changing the WSDL to

            <s:element minOccurs="1" maxOccurs="1" name="asset" type="s:base64Binary" xmime:expectedContentTypes="application/octet-stream"/>
            


            resolved the problem.