use of jakarta.xml.soap.SOAPBody in project metro-jax-ws by eclipse-ee4j.
the class AllResponsesTest method testNonAnonymousReplyTo.
public void testNonAnonymousReplyTo() throws Exception {
invokeAsync(createDispatchWithoutAddressing(), TestMessages.NON_ANONYMOUS_REPLY_TO_COMPLETE_MESSAGE, S11_NS, nonAnonAddress, action, endpointAddress, "testNonAnonymousReplyTo");
// Lets see we get a response in 60 s
SOAPMessage m = respMsgExchanger.exchange(null, TestMessages.CLIENT_MAX_TIMEOUT, TimeUnit.SECONDS);
// System.out.println("****************************");
// m.writeTo(System.out);
// System.out.println("\n****************************");
SOAPBody sb = m.getSOAPBody();
Iterator itr = sb.getChildElements(new QName("http://server.responses.wsa.fromjava/", "addNumbersResponse"));
assertTrue(itr.hasNext());
}
use of jakarta.xml.soap.SOAPBody in project metro-jax-ws by eclipse-ee4j.
the class DefaultResponsesTest method testNonAnonymousFaultTo1.
/**
* Normal response case,just tests if the endpoint accepts non-anon FaultTo
* @throws Exception
*/
public void testNonAnonymousFaultTo1() throws Exception {
SOAPMessage response = invoke(createDispatchWithoutAddressing(), TestMessages.NON_ANONYMOUS_FAULT_TO_COMPLETE_MESSAGE, S11_NS, nonAnonAddress, action, endpointAddress, "testNonAnonymousReplyTo");
SOAPBody sb = response.getSOAPBody();
Iterator itr = sb.getChildElements(new QName("http://server.responses.wsa.fromjava/", "addNumbersResponse"));
assertTrue(itr.hasNext());
}
use of jakarta.xml.soap.SOAPBody in project metro-jax-ws by eclipse-ee4j.
the class DefaultResponsesTest method testNonAnonymousFaultTo2.
/**
* Fault response case
* @throws Exception
*/
public void testNonAnonymousFaultTo2() throws Exception {
invokeAsync(createDispatchWithoutAddressing(), TestMessages.NON_ANONYMOUS_FAULT_TO_COMPLETE_FAULTY_MESSAGE, S11_NS, nonAnonAddress, action, endpointAddress, "testNonAnonymousReplyTo");
// Lets see we get a response in 60 s
SOAPMessage m = respMsgExchanger.exchange(null, TestMessages.CLIENT_MAX_TIMEOUT, TimeUnit.SECONDS);
// System.out.println("****************************");
// m.writeTo(System.out);
// System.out.println("\n****************************");
SOAPBody sb = m.getSOAPBody();
assertTrue(sb.hasFault());
SOAPFault fault = sb.getFault();
assertEquals(fault.getFaultString(), "Negative numbers can't be added!");
}
use of jakarta.xml.soap.SOAPBody in project metro-jax-ws by eclipse-ee4j.
the class DefaultResponsesTest method testNonAnonymousReplyTo.
public void testNonAnonymousReplyTo() throws Exception {
invokeAsync(createDispatchWithoutAddressing(), TestMessages.NON_ANONYMOUS_REPLY_TO_COMPLETE_MESSAGE, S11_NS, nonAnonAddress, action, endpointAddress, "testNonAnonymousReplyTo");
// Lets see we get a response in 60 s
SOAPMessage m = respMsgExchanger.exchange(null, TestMessages.CLIENT_MAX_TIMEOUT, TimeUnit.SECONDS);
// System.out.println("****************************");
// m.writeTo(System.out);
// System.out.println("\n****************************");
SOAPBody sb = m.getSOAPBody();
Iterator itr = sb.getChildElements(new QName("http://server.responses.wsa.fromjava/", "addNumbersResponse"));
assertTrue(itr.hasNext());
}
use of jakarta.xml.soap.SOAPBody in project metro-jax-ws by eclipse-ee4j.
the class ClientHandler method handleMessage.
public boolean handleMessage(SOAPMessageContext context) {
SOAPMessage sm = context.getMessage();
try {
SOAPBody sb = sm.getSOAPBody();
System.out.println("Inside ClientHandler...");
Node n = sb.getFirstChild();
if (n != null) {
if ((Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) {
if (n.getLocalName().equals("echo3")) {
if (!n.getNamespaceURI().equals("http://tempuri.org/wsdl"))
throw new WebServiceException("Expected: \"http://tempuri.org/wsdl\", got: " + n.getNamespaceURI());
else
return true;
}
if (!n.getNamespaceURI().equals("http://tempuri.org/")) {
throw new WebServiceException("Expected: \"http://tempuri.org/\", got: " + n.getNamespaceURI());
}
} else {
if (n.getLocalName().equals("echo3Response")) {
if (!n.getNamespaceURI().equals("http://example.com/echo3"))
throw new WebServiceException("Expected: \"http://example.com/echo3\", got: " + n.getNamespaceURI());
else
return true;
}
if (!n.getNamespaceURI().equals("http://example.com/")) {
throw new WebServiceException("Expected: \"http://example.com/\", got: " + n.getNamespaceURI());
}
}
} else {
return true;
}
} catch (SOAPException e) {
throw new WebServiceException(e);
}
return true;
}
Aggregations