use of org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory in project cxf by apache.
the class UndertowBasicAuthTest method testGetWSDL.
@org.junit.Test
public void testGetWSDL() throws Exception {
BusFactory bf = BusFactory.newInstance();
Bus bus = bf.createBus();
bus.getInInterceptors().add(new LoggingInInterceptor());
bus.getOutInterceptors().add(new LoggingOutInterceptor());
MyHTTPConduitConfigurer myHttpConduitConfig = new MyHTTPConduitConfigurer();
bus.setExtension(myHttpConduitConfig, HTTPConduitConfigurer.class);
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(bus);
factory.createClient(ADDRESS + "?wsdl");
}
use of org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory in project cxf by apache.
the class UndertowDigestAuthTest method testGetWSDL.
@Test
public void testGetWSDL() throws Exception {
BusFactory bf = BusFactory.newInstance();
Bus bus = bf.createBus();
bus.getInInterceptors().add(new LoggingInInterceptor());
bus.getOutInterceptors().add(new LoggingOutInterceptor());
MyHTTPConduitConfigurer myHttpConduitConfig = new MyHTTPConduitConfigurer();
bus.setExtension(myHttpConduitConfig, HTTPConduitConfigurer.class);
JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance(bus);
factory.createClient(ADDRESS + "?wsdl");
}
use of org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory in project cxf by apache.
the class JaxWsDynamicClientTest method testInvocation.
@Test
public void testInvocation() throws Exception {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
URL wsdlURL = new URL("http://localhost:" + PORT + "/NoBodyParts/NoBodyPartsService?wsdl");
Client client = dcf.createClient(wsdlURL);
byte[] bucketOfBytes = IOUtils.readBytesFromStream(getClass().getResourceAsStream("/wsdl/no_body_parts.wsdl"));
Operation1 parameters = new Operation1();
parameters.setOptionString("opt-ion");
parameters.setTargetType("tar-get");
Object[] rparts = client.invoke("operation1", parameters, bucketOfBytes);
Operation1Response r = (Operation1Response) rparts[0];
assertEquals(md5(bucketOfBytes), r.getStatus());
ClientCallback callback = new ClientCallback();
client.invoke(callback, "operation1", parameters, bucketOfBytes);
rparts = callback.get();
r = (Operation1Response) rparts[0];
assertEquals(md5(bucketOfBytes), r.getStatus());
}
use of org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory in project cu-kfs by CU-CommunityApps.
the class CULegacyTravelServiceImpl method reopenLegacyTrip.
/**
* @param dvID
* @param disapproveReason
* @return
*/
public boolean reopenLegacyTrip(String docID, String disapproveReason) {
Client client = null;
// Need to grab copy of current class loader because call to web services wrecks class loader, so we want to restore it following call.
ClassLoader classLoader = ClassLoaderUtils.getDefaultClassLoader();
try {
URL wsdlUrl = new URL(updateTripWsdl);
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
client = dcf.createClient(wsdlUrl);
configureWebServiceClient(client);
// Method signature on Travel side: updateTrip(String status, String updaterNetID, String dvID, String voidReason)
Object[] results1 = client.invoke(DFA_TRAVEL_WS_METHODS.UPDATE_TRIP, KFS_DOC_VOIDED, GlobalVariables.getUserSession().getPrincipalName(), docID, disapproveReason);
Boolean tripReopened = (Boolean) results1[0];
return tripReopened;
} catch (SoapFault sf) {
LOG.error(sf.getMessage());
sf.printStackTrace();
return false;
} catch (Exception ex) {
LOG.info("Exception occurred while trying to cancel a trip.");
ex.printStackTrace();
return false;
} finally {
if (client != null) {
client.destroy();
}
// Restore class loader that was grabbed before call to web service
ContextClassLoaderBinder.bind(classLoader);
}
}
use of org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory in project springBoot-learn-demo by nbfujx.
the class CxfClient method echo.
public static void echo() {
// 创建动态客户端
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient("http://localhost:8080/services/ExampleService?wsdl");
Object[] objects = new Object[0];
try {
objects = client.invoke("echo", "str");
System.out.println("echo:" + objects[0]);
} catch (java.lang.Exception e) {
e.printStackTrace();
}
}
Aggregations