Related to my previous question. I am trying to build a SOAP message (without using JAXRPC) to invoke a JAXRPC service.
The service is at
http://localhost:8080/currencyConverterAspects-jaxrpc/currencyConverterAspects?WSDL
And it offers one operation, convert, with three string parametres. The code I execute is:
SOAPConnectionFactory soapConnectionFactory =
SOAPConnectionFactory.newInstance();
SOAPConnection connection =
soapConnectionFactory.createConnection();
MessageFactory messageFactory =
MessageFactory.newInstance();
SOAPMessage message =
messageFactory.createMessage();
SOAPPart part = message.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPBody body = envelope.getBody();
SOAPFactory soapFactory =
SOAPFactory.newInstance();
Name bodyName = envelope.createName("convert", "foo",
"MyCurrencyConverterAspectsService");
SOAPBodyElement convert = body.addBodyElement(bodyName);
Name amountName = envelope.createName("String_1");
SOAPElement amount = convert.addChildElement(amountName);
amount.addTextNode("10");
Name fromCurrencyName = envelope.createName("String_2");
SOAPElement fromCurrency = convert.addChildElement(fromCurrencyName);
fromCurrency.addTextNode("USD");
Name toCurrencyName = envelope.createName("String_3");
SOAPElement toCurrency= convert.addChildElement(toCurrencyName);
toCurrency.addTextNode("EUR");
message.saveChanges();
System.out.println("\n--- Request Message ---\n");
message.writeTo(System.out);
URL endpoint = new URL("
http://localhost:8080/currencyConverterAspects-jaxrpc/currencyConverterAspects");
SOAPMessage reply =
connection.call(message, endpoint);
System.out.println("\n\nReceived reply from: " +
endpoint);
System.out.println("\n---- Reply Message ----\n");
reply.writeTo(System.out);
The fault code I receive in a SOAP faultString is:
[...]<faultString>JAXRPC.TIE01: caugh exception while handling request: unrecognized operation {MyCurrencyConverterAspectsService}convert</faultString>
Any clue about what I am doing wrong? Thanks in advance,
Guadalupe