You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by stephen chan <st...@netnation.com> on 2002/08/07 00:42:26 UTC
problem with message service
Hello:
I am working through the book examples in Java and SOAP from O'Reilly.
At the beginning of Chapter 8 there's a simple messaging example, I
deployed it like this:
- java org.apache.soap.server.ServiceManagerClient
http://localhost:8080/soap/servlet/rpcrouter deploy WeatherDiary.dd
I can see the above service deployed in SOAP admin. When I run the
corresponding client to talk to the server, I get this:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Exception while handling service request:
WeatherDiary.recordTemperature(org.apache.soap.Envelope,org.apache.soap.
rpc.SOAPContext,org.apache.soap.rpc.SOAPContext) -- no signature
match</faultstring>
<faultactor>/soap/servlet/messagerouter</faultactor>
<detail>
<stackTrace>java.lang.NoSuchMethodException:
WeatherDiary.recordTemperature(org.apache.soap.Envelope,org.apache.soap.
rpc.SOAPContext,org.apache.soap.rpc.SOAPContext) -- no signature match
at
org.apache.soap.util.MethodUtils.getEntryPoint(MethodUtils.java:194)
at
org.apache.soap.util.MethodUtils.getMethod(MethodUtils.java:548)
cut...
Why do I get a "NoSuchMethodException"? I think I have deployed the
service correctly. BTW, the same happened when I tried a messaging
example from another book. I don't have this problem with RPC SOAP
services.
-----------------------------------------------
WeatherDiary.dd
<isd:service
xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:WeatherDiary" type="message">
<isd:provider
type="java"
scope="Application"
methods="recordTemperature">
<isd:java
class="WeatherDiary"
static="false"/>
</isd:provider>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultLis
tener>
<isd:mappings>
</isd:mappings>
</isd:service>
------------------------------------------------------------------------
---
WeatherDiary.java
import java.io.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.SOAPContext;
import javax.mail.MessagingException;
import org.w3c.dom.*;
public class WeatherDiary
{
Hashtable _diary = new Hashtable();
public void recordTemperature(Envelope env,
SOAPContext reqCtx,
SOAPContext resCtx)
throws Exception
{
Vector v = env.getBody().getBodyEntries();
int cnt = v.size();
String zipcode = null;
String temperature = null;
for (int i = 0; i < cnt; i++)
{
Element e = (Element)v.elementAt(i);
String name = e.getTagName();
if(name.equals("zipcode"))
{
zipcode = e.getFirstChild().getNodeValue();
}
else if(name.equals("temperature"))
{
temperature = e.getFirstChild().getNodeValue();
}
}
if (zipcode == null || temperature == null)
throw new IllegalArgumentException("ZIPCODE and/or
TEMPERATURE Not Specified");
_diary.put(zipcode, temperature);
resCtx.setRootPart("OK", "text/xml");
}
}
------------------------------------------------------------------------
----
WeatherClient.java
import java.io.*;
import java.net.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.apache.soap.*;
import org.apache.soap.messaging.*;
import org.apache.soap.transport.*;
import org.apache.soap.util.xml.*;
public class WeatherClient {
public static void main (String[] args) throws Exception {
DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
Document doc = xdb.newDocument();
Element elem =
doc.createElementNS(Constants.NS_URI_SOAP_ENV,
"SOAP-ENV:Envelope");
doc.appendChild(elem);
Element sub =
doc.createElementNS(Constants.NS_URI_SOAP_ENV,
"SOAP-ENV:Body");
elem.appendChild(sub);
elem = sub;
sub = doc.createElement("recordTemperature");
sub.setAttribute("xmlns", "urn:WeatherDiary");
elem.appendChild(sub);
sub = doc.createElement("zipcode");
Text txt = doc.createTextNode("");
txt.setData("12345");
sub.appendChild(txt);
elem.appendChild(sub);
sub = doc.createElement("temperature");
txt = doc.createTextNode("");
txt.setData("52.3");
sub.appendChild(txt);
elem.appendChild(sub);
Envelope msgEnv = Envelope.unmarshall(
doc.getDocumentElement());
URL url = new URL(
"http://localhost:8080/soap/servlet/messagerouter");
Message msg = new Message();
msg.send(url, "", msgEnv);
SOAPTransport st = msg.getSOAPTransport();
BufferedReader br = st.receive();
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
}
}
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
RE: problem with message service
Posted by stephen chan <st...@netnation.com>.
Sorry Folks. Should have read Apache-SOAP User's FAQ.
It was a XML classloading issue.
This is not the first time I had problems with Tomcat and XML libraries
:-[
Thanks.
Stephen
========================================================================
=========
-----Original Message-----
From: stephen chan [mailto:stephenc@netnation.com]
Sent: Tuesday, August 06, 2002 3:42 PM
To: soap-user@xml.apache.org
Subject: problem with message service
Hello:
I am working through the book examples in Java and SOAP from O'Reilly.
At the beginning of Chapter 8 there's a simple messaging example, I
deployed it like this:
- java org.apache.soap.server.ServiceManagerClient
http://localhost:8080/soap/servlet/rpcrouter deploy WeatherDiary.dd
I can see the above service deployed in SOAP admin. When I run the
corresponding client to talk to the server, I get this:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Exception while handling service request:
WeatherDiary.recordTemperature(org.apache.soap.Envelope,org.apache.soap.
rpc.SOAPContext,org.apache.soap.rpc.SOAPContext) -- no signature
match</faultstring> <faultactor>/soap/servlet/messagerouter</faultactor>
<detail>
<stackTrace>java.lang.NoSuchMethodException:
WeatherDiary.recordTemperature(org.apache.soap.Envelope,org.apache.soap.
rpc.SOAPContext,org.apache.soap.rpc.SOAPContext) -- no signature match
at
org.apache.soap.util.MethodUtils.getEntryPoint(MethodUtils.java:194)
at
org.apache.soap.util.MethodUtils.getMethod(MethodUtils.java:548)
cut...
Why do I get a "NoSuchMethodException"? I think I have deployed the
service correctly. BTW, the same happened when I tried a messaging
example from another book. I don't have this problem with RPC SOAP
services.
-----------------------------------------------
WeatherDiary.dd
<isd:service
xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:WeatherDiary" type="message">
<isd:provider
type="java"
scope="Application"
methods="recordTemperature">
<isd:java
class="WeatherDiary"
static="false"/>
</isd:provider>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultLis
tener>
<isd:mappings>
</isd:mappings>
</isd:service>
------------------------------------------------------------------------
---
WeatherDiary.java
import java.io.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.SOAPContext;
import javax.mail.MessagingException;
import org.w3c.dom.*;
public class WeatherDiary
{
Hashtable _diary = new Hashtable();
public void recordTemperature(Envelope env,
SOAPContext reqCtx,
SOAPContext resCtx)
throws Exception
{
Vector v = env.getBody().getBodyEntries();
int cnt = v.size();
String zipcode = null;
String temperature = null;
for (int i = 0; i < cnt; i++)
{
Element e = (Element)v.elementAt(i);
String name = e.getTagName();
if(name.equals("zipcode"))
{
zipcode = e.getFirstChild().getNodeValue();
}
else if(name.equals("temperature"))
{
temperature = e.getFirstChild().getNodeValue();
}
}
if (zipcode == null || temperature == null)
throw new IllegalArgumentException("ZIPCODE and/or
TEMPERATURE Not Specified");
_diary.put(zipcode, temperature);
resCtx.setRootPart("OK", "text/xml");
}
}
------------------------------------------------------------------------
----
WeatherClient.java
import java.io.*;
import java.net.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.apache.soap.*;
import org.apache.soap.messaging.*;
import org.apache.soap.transport.*;
import org.apache.soap.util.xml.*;
public class WeatherClient {
public static void main (String[] args) throws Exception {
DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
Document doc = xdb.newDocument();
Element elem =
doc.createElementNS(Constants.NS_URI_SOAP_ENV,
"SOAP-ENV:Envelope");
doc.appendChild(elem);
Element sub =
doc.createElementNS(Constants.NS_URI_SOAP_ENV,
"SOAP-ENV:Body");
elem.appendChild(sub);
elem = sub;
sub = doc.createElement("recordTemperature");
sub.setAttribute("xmlns", "urn:WeatherDiary");
elem.appendChild(sub);
sub = doc.createElement("zipcode");
Text txt = doc.createTextNode("");
txt.setData("12345");
sub.appendChild(txt);
elem.appendChild(sub);
sub = doc.createElement("temperature");
txt = doc.createTextNode("");
txt.setData("52.3");
sub.appendChild(txt);
elem.appendChild(sub);
Envelope msgEnv = Envelope.unmarshall(
doc.getDocumentElement());
URL url = new URL(
"http://localhost:8080/soap/servlet/messagerouter");
Message msg = new Message();
msg.send(url, "", msgEnv);
SOAPTransport st = msg.getSOAPTransport();
BufferedReader br = st.receive();
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
}
}
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
RE: problem with message service
Posted by stephen chan <st...@netnation.com>.
Sorry Folks. Should have read Apache-SOAP User's FAQ.
It was a XML classloading issue.
This is not the first time I had problems with Tomcat and XML libraries
:-[
Thanks.
Stephen
========================================================================
=========
-----Original Message-----
From: stephen chan [mailto:stephenc@netnation.com]
Sent: Tuesday, August 06, 2002 3:42 PM
To: soap-user@xml.apache.org
Subject: problem with message service
Hello:
I am working through the book examples in Java and SOAP from O'Reilly.
At the beginning of Chapter 8 there's a simple messaging example, I
deployed it like this:
- java org.apache.soap.server.ServiceManagerClient
http://localhost:8080/soap/servlet/rpcrouter deploy WeatherDiary.dd
I can see the above service deployed in SOAP admin. When I run the
corresponding client to talk to the server, I get this:
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Exception while handling service request:
WeatherDiary.recordTemperature(org.apache.soap.Envelope,org.apache.soap.
rpc.SOAPContext,org.apache.soap.rpc.SOAPContext) -- no signature
match</faultstring> <faultactor>/soap/servlet/messagerouter</faultactor>
<detail>
<stackTrace>java.lang.NoSuchMethodException:
WeatherDiary.recordTemperature(org.apache.soap.Envelope,org.apache.soap.
rpc.SOAPContext,org.apache.soap.rpc.SOAPContext) -- no signature match
at
org.apache.soap.util.MethodUtils.getEntryPoint(MethodUtils.java:194)
at
org.apache.soap.util.MethodUtils.getMethod(MethodUtils.java:548)
cut...
Why do I get a "NoSuchMethodException"? I think I have deployed the
service correctly. BTW, the same happened when I tried a messaging
example from another book. I don't have this problem with RPC SOAP
services.
-----------------------------------------------
WeatherDiary.dd
<isd:service
xmlns:isd="http://xml.apache.org/xml-soap/deployment"
id="urn:WeatherDiary" type="message">
<isd:provider
type="java"
scope="Application"
methods="recordTemperature">
<isd:java
class="WeatherDiary"
static="false"/>
</isd:provider>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultLis
tener>
<isd:mappings>
</isd:mappings>
</isd:service>
------------------------------------------------------------------------
---
WeatherDiary.java
import java.io.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.rpc.SOAPContext;
import javax.mail.MessagingException;
import org.w3c.dom.*;
public class WeatherDiary
{
Hashtable _diary = new Hashtable();
public void recordTemperature(Envelope env,
SOAPContext reqCtx,
SOAPContext resCtx)
throws Exception
{
Vector v = env.getBody().getBodyEntries();
int cnt = v.size();
String zipcode = null;
String temperature = null;
for (int i = 0; i < cnt; i++)
{
Element e = (Element)v.elementAt(i);
String name = e.getTagName();
if(name.equals("zipcode"))
{
zipcode = e.getFirstChild().getNodeValue();
}
else if(name.equals("temperature"))
{
temperature = e.getFirstChild().getNodeValue();
}
}
if (zipcode == null || temperature == null)
throw new IllegalArgumentException("ZIPCODE and/or
TEMPERATURE Not Specified");
_diary.put(zipcode, temperature);
resCtx.setRootPart("OK", "text/xml");
}
}
------------------------------------------------------------------------
----
WeatherClient.java
import java.io.*;
import java.net.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
import org.apache.soap.*;
import org.apache.soap.messaging.*;
import org.apache.soap.transport.*;
import org.apache.soap.util.xml.*;
public class WeatherClient {
public static void main (String[] args) throws Exception {
DocumentBuilder xdb = XMLParserUtils.getXMLDocBuilder();
Document doc = xdb.newDocument();
Element elem =
doc.createElementNS(Constants.NS_URI_SOAP_ENV,
"SOAP-ENV:Envelope");
doc.appendChild(elem);
Element sub =
doc.createElementNS(Constants.NS_URI_SOAP_ENV,
"SOAP-ENV:Body");
elem.appendChild(sub);
elem = sub;
sub = doc.createElement("recordTemperature");
sub.setAttribute("xmlns", "urn:WeatherDiary");
elem.appendChild(sub);
sub = doc.createElement("zipcode");
Text txt = doc.createTextNode("");
txt.setData("12345");
sub.appendChild(txt);
elem.appendChild(sub);
sub = doc.createElement("temperature");
txt = doc.createTextNode("");
txt.setData("52.3");
sub.appendChild(txt);
elem.appendChild(sub);
Envelope msgEnv = Envelope.unmarshall(
doc.getDocumentElement());
URL url = new URL(
"http://localhost:8080/soap/servlet/messagerouter");
Message msg = new Message();
msg.send(url, "", msgEnv);
SOAPTransport st = msg.getSOAPTransport();
BufferedReader br = st.receive();
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
}
}
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>
--
To unsubscribe, e-mail: <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>