If you drill down into the message package:
jboss/jbosstest/src/main/org/jboss/test/webservice/message
you will find the server side implementation:
| /*
| * JBoss, the OpenSource J2EE webOS
| *
| * Distributable under LGPL license.
| * See terms of license at gnu.org.
| */
| package org.jboss.test.webservice.message;
|
| // $Id: MessageEndpointImpl.java,v 1.1.2.2 2004/12/08 15:43:46 tdiesler Exp
$
|
| import com.ibm.wsdl.util.xml.DOM2Writer;
| import org.jboss.logging.Logger;
| import org.w3c.dom.Document;
| import org.w3c.dom.Element;
|
| import javax.xml.parsers.DocumentBuilder;
| import javax.xml.parsers.DocumentBuilderFactory;
| import javax.xml.soap.Name;
| import javax.xml.soap.SOAPElement;
| import javax.xml.soap.SOAPFactory;
| import java.io.ByteArrayInputStream;
| import java.io.StringWriter;
| import java.rmi.RemoteException;
|
| /**
| * @author [EMAIL PROTECTED]
| * @since 26-Nov-2004
| */
| public class MessageEndpointImpl implements MessageEndpoint
| {
| // provide logging
| private final Logger log = Logger.getLogger(MessageEndpointImpl.class);
|
| public Element processElement(Element msg) throws RemoteException
| {
| StringWriter swr = new StringWriter();
| DOM2Writer.serializeAsXML(msg, swr);
| log.info("req: " + swr);
|
| SOAPElement soapElement = (SOAPElement)msg;
|
| try
| {
| SOAPFactory factory = SOAPFactory.newInstance();
|
| Name name = factory.createName("Order", PREFIX, NAMESPACE_URI);
| Name elementName = soapElement.getElementName();
| if (name.equals(elementName) == false)
| throw new IllegalArgumentException("Unexpected element: " +
elementName);
|
| name = factory.createName("Customer");
| soapElement =
(SOAPElement)soapElement.getChildElements(name).next();
| String elementValue = soapElement.getValue();
| if ("Customer".equals(soapElement.getLocalName()) &&
"Kermit".equals(elementValue) == false)
| throw new IllegalArgumentException("Unexpected element value: "
+ elementValue);
|
| soapElement = (SOAPElement)soapElement.getNextSibling();
| elementValue = soapElement.getValue();
| if ("Item".equals(soapElement.getLocalName()) &&
"Ferrari".equals(elementValue) == false)
| throw new IllegalArgumentException("Unexpected element value: "
+ elementValue);
|
| // Setup document builder
| DocumentBuilderFactory docBuilderFactory =
DocumentBuilderFactory.newInstance();
| docBuilderFactory.setNamespaceAware(true);
|
| // Prepare response
| DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
| Document doc = builder.parse(new
ByteArrayInputStream(response.getBytes()));
| log.info("res: " + response);
| return doc.getDocumentElement();
| }
| catch (RuntimeException e)
| {
| throw e;
| }
| catch (Exception e)
| {
| throw new RemoteException(e.toString(), e);
| }
| }
| }
|
The associated deployment descriptors may be found under:
http://cvs.sourceforge.net/viewcvs.py/jboss/jbosstest/src/resources/webservice/message/
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3864245#3864245
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3864245
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user