Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Web Services
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Web Services
Server.userException / No such operation
Uli Schmidt
Greenhorn
Posts: 1
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hey Guys,
I´m trying do send a
SOAP
Request but i´m stuck since a few days.
My code looks like this:
import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.soap.*; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamResult; public class SOAPClient { private static final String endpoint = "http://localhost:8080/services/dbinterface"; public static void main(String[] args) throws SOAPException { SOAPConnection connection = SOAPConnectionFactory.newInstance().createConnection(); SOAPMessage message = MessageFactory.newInstance().createMessage(); SOAPHeader header = message.getSOAPHeader(); header.detachNode(); SOAPEnvelope envelope = message.getSOAPPart().getEnvelope(); envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema"); envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance"); SOAPBody body = message.getSOAPBody(); QName bodyName = new QName("http://localhost:8080/services/dbinterface", "getDataXML", "m"); SOAPBodyElement bodyElement = body.addBodyElement(bodyName); SOAPElement bodyElement4 = bodyElement.addChildElement("general"); SOAPElement bodyElement5 = bodyElement4.addChildElement("object"); bodyElement5.addTextNode("personKurzInfo"); SOAPElement bodyElement6 = bodyElement4.addChildElement("group"); bodyElement6.addTextNode(""); SOAPElement bodyElement7 = bodyElement.addChildElement("condition"); SOAPElement bodyElement8 = bodyElement7.addChildElement("id"); bodyElement8.addTextNode("3510"); SOAPElement bodyElement9 = bodyElement.addChildElement("user-auth"); SOAPElement bodyElement10 = bodyElement9.addChildElement("token"); bodyElement10.addTextNode(""); SOAPElement bodyElement11 = bodyElement.addChildElement("search"); bodyElement11.addTextNode(""); SOAPElement bodyElement12 = bodyElement.addChildElement("limit"); bodyElement12.addTextNode("20"); SOAPElement bodyElement13 = bodyElement.addChildElement("offset"); bodyElement13.addTextNode("0"); SOAPElement bodyElement14 = bodyElement.addChildElement("language"); bodyElement14.addTextNode("de-DE"); MimeHeaders headers = message.getMimeHeaders(); headers.addHeader("SOAPAction", endpoint); /* Print the request message */ System.out.print("Request SOAP Message = "); try { message.writeTo(System.out); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } System.out.println(); SOAPMessage response = connection.call(message, endpoint); // Process the SOAP Response try { printSOAPResponse(response); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } connection.close(); } private static void printSOAPResponse(SOAPMessage soapResponse) throws Exception { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); Source sourceContent = soapResponse.getSOAPPart().getContent(); System.out.print("\nResponse SOAP Message = "); StreamResult result = new StreamResult(System.out); transformer.transform(sourceContent, result); } }
In the wsdl-file is the operation 'getDataXML', as you can see:
. . <wsdl:operation name="getDataXML" parameterOrder="xmlParams"> <wsdl:input message="impl:getDataXMLRequest" name="getDataXMLRequest"></wsdl:input> <wsdl:output message="impl:getDataXMLResponse" name="getDataXMLResponse"></wsdl:output> </wsdl:operation> . .
But when i run the code i get the following response:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <soapenv:Fault> <faultcode>Server.userException</faultcode> <faultstring>No such operation 'getDataXML'</faultstring> <detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">lsf2</ns1:hostname></detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
Somebody has an idea on this?
Thanks!
Uli
We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Optional operation parameters (long types)
Strange behavior with input parameter valuse during web service invocation
dynamic generation of SOAP request using JAVA
creating soap requests in java
Calling Web Service Method using SAAJ
More...