سؤال

I'm trying to call a web service and add an attachment to my request using mtom. Mtom is enabled on the web service I'm calling and I can call the service ok using soapui.

The schema for the request looks like this;

<element name="MyRequest">
    <complexType>
        <sequence>
            ...
            <element name="content" type="base64Binary"
                xmime:expectedContentTypes="text/xml" />
        </sequence>
    </complexType>
</element>

In my java code I then create the jaxb request object and attempt to set the content from a string;

MyRequest request = factory.createMyRequest();

StreamSource ss = new StreamSource(new StringReader("some content..."));

request.setContent(ss);

WebServiceTemplate wst = ...;

wst.marshalSendAndReceive(request);

I've set my marshaller to have mtom enabled (although I'm not sure this is necessary on the client);

<bean id="my-marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
    <property name="contextPath" value="..."/>
    <property name="mtomEnabled" value="true"/>
</bean>

But I get the following exception;

javax.xml.transform.TransformerFactoryConfigurationError: Provider net.sf.saxon.TransformerFactoryImpl not found

Does anyone have any ideas of what I'm doing wrong or can anyone show me an example of how to marshal a jaxb request with an mtom attachment from a spring-ws client? Help would be greatly appreciated.

هل كانت مفيدة؟

المحلول

This was actually as simple as adding saxon into my classpath/pom. I think that the saaj message stuff in spring-ws client insists on using saxon to push the source for the mtom attachment into the generated request.

My code as it is actually works but I'll leave it here as in much searching on the net I couldn't find any good examples of how to send a jaxb request with mtom attachment from a spring-ws client so others might find this useful.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top