• Post Reply Bookmark Topic Watch Topic
  • New Topic

Simulating a SOAP service with a static JSP  RSS feed

 
Juha Siltanen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello gurus!
I'm trying to make a very simple simulator for a SOAP server/service. This jsp-page is a static JSP-page, which actually has a structure of a SOAP-envelope hard coded. I just want my connector-service to pass a SOAP envelope to this page (which does nothing to it) and returns it's contents to my connector. In other words, the JSP-page does nothing. The connector just fetches the contents of this page and processes it in the same way a regular SOAP-message would be processed.
The jsp-page is somewhat like follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page language="java" %>
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="...">
<env:Header>
<status xmlns="...">OK</status>
</env:Header>
<env:Body>
</env:Body>
</env:Envelope>
<HTML>
<HEAD>
<META name="GENERATOR" content="IBM WebSphere Studio">
</HEAD>
</HTML>
I receive a NoClassDefFoundError (com.sun.mail.util.BASE64DecoderStream), and the stack trace is...
java.lang.NoClassDefFoundError: com/sun/mail/util/BASE64DecoderStream
at javax.mail.internet.ParameterList.quote(ParameterList.java:157)
at javax.mail.internet.ParameterList.toString(ParameterList.java:148)
at javax.mail.internet.ContentType.toString(ContentType.java:187)
at javax.mail.internet.MimeMultipart.<init>(MimeMultipart.java:92)
at org.apache.soap.rpc.SOAPContext.addBodyPart(SOAPContext.java:322)
at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:380)
at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:419)
at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:394)
at org.apache.soap.transport.TransportMessage.save(TransportMessage.java:303)
at org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:290)
at org.apache.soap.messaging.Message.send(Message.java:123)
I'd really apprechiate if someone could explain what is wrong and what actually happens.
 
Juha Siltanen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In addition to my last post, if anyone has a good and very simple way to test a SOAP connector, please help me. It doesn't have to do any processing of the message, just return a specific kind of response so that I can test my connector's message handling. Thank you!
-J-
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a simple utility to trap the text of conversations between a SOAP client and server. It can also be used to fake either side of the conversation with static text. Download from:
http://www.wbrogden.com/books/javasoap/default.htm
Let me know if you have any problems with it.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Juha Siltanen:
Hello gurus!
I'm trying to make a very simple simulator for a SOAP server/service. This jsp-page is a static JSP-page, which actually has a structure of a SOAP-envelope hard coded. I just want my connector-service to pass a SOAP envelope to this page (which does nothing to it) and returns it's contents to my connector. In other words, the JSP-page does nothing. The connector just fetches the contents of this page and processes it in the same way a regular SOAP-message would be processed.
The jsp-page is somewhat like follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@page language="java" %>
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="...">
<env:Header>
<status xmlns="...">OK</status>
</env:Header>
<env:Body>
</env:Body>
</env:Envelope>
<HTML>
<HEAD>
<META name="GENERATOR" content="IBM WebSphere Studio">
</HEAD>
</HTML>
I receive a NoClassDefFoundError (com.sun.mail.util.BASE64DecoderStream), and the stack trace is...
java.lang.NoClassDefFoundError: com/sun/mail/util/BASE64DecoderStream
at javax.mail.internet.ParameterList.quote(ParameterList.java:157)
at javax.mail.internet.ParameterList.toString(ParameterList.java:148)
at javax.mail.internet.ContentType.toString(ContentType.java:187)
at javax.mail.internet.MimeMultipart.<init>(MimeMultipart.java:92)
at org.apache.soap.rpc.SOAPContext.addBodyPart(SOAPContext.java:322)
at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:380)
at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:419)
at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:394)
at org.apache.soap.transport.TransportMessage.save(TransportMessage.java:303)
at org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:290)
at org.apache.soap.messaging.Message.send(Message.java:123)
I'd really apprechiate if someone could explain what is wrong and what actually happens.

Just add mail.jar (Sun's Javamail JAR file) to your classpath and it will fix this error.
Kyle
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!