Search in sources :

Example 1 with DoubleItMtomPortType

use of org.example.contract.doubleit.DoubleItMtomPortType in project cxf by apache.

the class MTOMSecurityTest method testAsymmetricBinaryBytesInAttachment.

// The difference between this test + the testAsymmetricBytesInAttachment test above is that
// the SOAP Body already contains BASE-64 encoded content.
@org.junit.Test
public void testAsymmetricBinaryBytesInAttachment() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = MTOMSecurityTest.class.getResource("client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricBinaryPort");
    DoubleItMtomPortType port = service.getPort(portQName, DoubleItMtomPortType.class);
    updateAddressPort(port, PORT);
    DataSource source = new FileDataSource(new File("src/test/resources/java.jpg"));
    DoubleIt4 doubleIt = new DoubleIt4();
    doubleIt.setNumberToDouble(25);
    port.doubleIt4(25, new DataHandler(source));
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) DoubleItMtomPortType(org.example.contract.doubleit.DoubleItMtomPortType) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DataHandler(javax.activation.DataHandler) URL(java.net.URL) FileDataSource(javax.activation.FileDataSource) DataSource(javax.activation.DataSource) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) FileDataSource(javax.activation.FileDataSource) DoubleIt4(org.example.schema.doubleit.DoubleIt4) File(java.io.File)

Example 2 with DoubleItMtomPortType

use of org.example.contract.doubleit.DoubleItMtomPortType in project cxf by apache.

the class MTOMSecurityTest method testAsymmetricBinaryEncryptBeforeSigningBytesInAttachment.

@org.junit.Test
public void testAsymmetricBinaryEncryptBeforeSigningBytesInAttachment() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = MTOMSecurityTest.class.getResource("client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItAsymmetricBinaryEncryptBeforeSigningPort");
    DoubleItMtomPortType port = service.getPort(portQName, DoubleItMtomPortType.class);
    updateAddressPort(port, PORT);
    DataSource source = new FileDataSource(new File("src/test/resources/java.jpg"));
    DoubleIt4 doubleIt = new DoubleIt4();
    doubleIt.setNumberToDouble(25);
    port.doubleIt4(25, new DataHandler(source));
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) DoubleItMtomPortType(org.example.contract.doubleit.DoubleItMtomPortType) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DataHandler(javax.activation.DataHandler) URL(java.net.URL) FileDataSource(javax.activation.FileDataSource) DataSource(javax.activation.DataSource) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) FileDataSource(javax.activation.FileDataSource) DoubleIt4(org.example.schema.doubleit.DoubleIt4) File(java.io.File)

Example 3 with DoubleItMtomPortType

use of org.example.contract.doubleit.DoubleItMtomPortType in project cxf by apache.

the class MTOMSecurityTest method testSymmetricBinaryBytesInAttachment.

@org.junit.Test
public void testSymmetricBinaryBytesInAttachment() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = MTOMSecurityTest.class.getResource("client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItSymmetricBinaryPort");
    DoubleItMtomPortType port = service.getPort(portQName, DoubleItMtomPortType.class);
    updateAddressPort(port, PORT);
    DataSource source = new FileDataSource(new File("src/test/resources/java.jpg"));
    DoubleIt4 doubleIt = new DoubleIt4();
    doubleIt.setNumberToDouble(25);
    port.doubleIt4(25, new DataHandler(source));
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) DoubleItMtomPortType(org.example.contract.doubleit.DoubleItMtomPortType) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DataHandler(javax.activation.DataHandler) URL(java.net.URL) FileDataSource(javax.activation.FileDataSource) DataSource(javax.activation.DataSource) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) FileDataSource(javax.activation.FileDataSource) DoubleIt4(org.example.schema.doubleit.DoubleIt4) File(java.io.File)

Example 4 with DoubleItMtomPortType

use of org.example.contract.doubleit.DoubleItMtomPortType in project cxf by apache.

the class MTOMSecurityTest method testSignedMTOMAction.

// Sign an attachment without inlining
@org.junit.Test
public void testSignedMTOMAction() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = MTOMSecurityTest.class.getResource("client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItSignedMTOMActionPort");
    DoubleItMtomPortType port = service.getPort(portQName, DoubleItMtomPortType.class);
    updateAddressPort(port, PORT);
    DataSource source = new FileDataSource(new File("src/test/resources/java.jpg"));
    DoubleIt4 doubleIt = new DoubleIt4();
    doubleIt.setNumberToDouble(25);
    port.doubleIt4(25, new DataHandler(source));
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) DoubleItMtomPortType(org.example.contract.doubleit.DoubleItMtomPortType) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DataHandler(javax.activation.DataHandler) URL(java.net.URL) FileDataSource(javax.activation.FileDataSource) DataSource(javax.activation.DataSource) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) FileDataSource(javax.activation.FileDataSource) DoubleIt4(org.example.schema.doubleit.DoubleIt4) File(java.io.File)

Example 5 with DoubleItMtomPortType

use of org.example.contract.doubleit.DoubleItMtomPortType in project cxf by apache.

the class MTOMSecurityTest method testSignedMTOMInline.

// The attachment is inlined + the SOAP Body signed
@org.junit.Test
public void testSignedMTOMInline() throws Exception {
    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = MTOMSecurityTest.class.getResource("client.xml");
    Bus bus = bf.createBus(busFile.toString());
    BusFactory.setDefaultBus(bus);
    BusFactory.setThreadDefaultBus(bus);
    URL wsdl = MTOMSecurityTest.class.getResource("DoubleItMtom.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItSignedMTOMInlinePort");
    DoubleItMtomPortType port = service.getPort(portQName, DoubleItMtomPortType.class);
    updateAddressPort(port, PORT);
    DataSource source = new FileDataSource(new File("src/test/resources/java.jpg"));
    DoubleIt4 doubleIt = new DoubleIt4();
    doubleIt.setNumberToDouble(25);
    port.doubleIt4(25, new DataHandler(source));
    ((java.io.Closeable) port).close();
    bus.shutdown(true);
}
Also used : Bus(org.apache.cxf.Bus) DoubleItMtomPortType(org.example.contract.doubleit.DoubleItMtomPortType) QName(javax.xml.namespace.QName) Service(javax.xml.ws.Service) DataHandler(javax.activation.DataHandler) URL(java.net.URL) FileDataSource(javax.activation.FileDataSource) DataSource(javax.activation.DataSource) SpringBusFactory(org.apache.cxf.bus.spring.SpringBusFactory) FileDataSource(javax.activation.FileDataSource) DoubleIt4(org.example.schema.doubleit.DoubleIt4) File(java.io.File)

Aggregations

File (java.io.File)5 URL (java.net.URL)5 DataHandler (javax.activation.DataHandler)5 DataSource (javax.activation.DataSource)5 FileDataSource (javax.activation.FileDataSource)5 QName (javax.xml.namespace.QName)5 Service (javax.xml.ws.Service)5 Bus (org.apache.cxf.Bus)5 SpringBusFactory (org.apache.cxf.bus.spring.SpringBusFactory)5 DoubleItMtomPortType (org.example.contract.doubleit.DoubleItMtomPortType)5 DoubleIt4 (org.example.schema.doubleit.DoubleIt4)5