Search in sources :

Example 11 with MessageContext

use of com.oracle.webservices.api.message.MessageContext in project metro-jax-ws by eclipse-ee4j.

the class DatabindingTest method testMessageContextFactory.

public void testMessageContextFactory() throws Exception {
    DatabindingFactory fac = DatabindingFactory.newInstance();
    Databinding.Builder builder = fac.createBuilder(Hello2.class, null);
    builder.targetNamespace("mytns");
    builder.serviceName(new QName("mytns", "myservice"));
    MessageContextFactory mcf = MessageContextFactory.createFactory();
    MySaajFac saajFac = new MySaajFac();
    mcf.setSAAJFactory(saajFac);
    builder.property("com.sun.xml.ws.api.message.MessageContextFactory", mcf);
    com.oracle.webservices.api.databinding.Databinding db = builder.build();
    assertTrue(((com.sun.xml.ws.api.databinding.Databinding) db).getMessageContextFactory() == mcf);
    Class[] paramType = { String.class };
    Object[] params = { "echoResponse" };
    com.oracle.webservices.api.databinding.JavaCallInfo call = db.createJavaCallInfo(Hello2.class.getMethod("echo", paramType), params);
    call.setReturnValue("echoResponse");
    MessageContext mc = db.serializeResponse(call);
    SOAPMessage soap = mc.getAsSOAPMessage();
    assertTrue(saajFac.called);
}
Also used : DatabindingFactory(com.oracle.webservices.api.databinding.DatabindingFactory) QName(javax.xml.namespace.QName) Databinding(com.oracle.webservices.api.databinding.Databinding) SOAPMessage(jakarta.xml.soap.SOAPMessage) Databinding(com.oracle.webservices.api.databinding.Databinding) MessageContextFactory(com.oracle.webservices.api.message.MessageContextFactory) MessageContext(com.oracle.webservices.api.message.MessageContext)

Aggregations

MessageContext (com.oracle.webservices.api.message.MessageContext)11 SOAPMessage (jakarta.xml.soap.SOAPMessage)9 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 Packet (com.sun.xml.ws.api.message.Packet)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 Databinding (com.oracle.webservices.api.databinding.Databinding)4 JavaCallInfo (com.oracle.webservices.api.databinding.JavaCallInfo)4 MessageContextFactory (com.oracle.webservices.api.message.MessageContextFactory)4 Message (com.sun.xml.ws.api.message.Message)4 DatabindingFactory (com.oracle.webservices.api.databinding.DatabindingFactory)3 AttachmentPart (jakarta.xml.soap.AttachmentPart)3 QName (javax.xml.namespace.QName)3 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)2 ContentType (com.oracle.webservices.api.message.ContentType)2 SOAPVersion (com.sun.xml.ws.api.SOAPVersion)2 Attachment (com.sun.xml.ws.api.message.Attachment)2 StreamingDataHandler (com.sun.xml.ws.developer.StreamingDataHandler)2 MIMEPartStreamingDataHandler (com.sun.xml.ws.encoding.MIMEPartStreamingDataHandler)2 MessageFactory (jakarta.xml.soap.MessageFactory)2 MimeHeaders (jakarta.xml.soap.MimeHeaders)2