XML Comments in SOAP message - jax-rpc

I ran across an issue with comments in my soap messages with regards to the serialization.
My solution was to strip all the comments inbound and outbound.
Are xml comments supported by JAX-RPC? I am currently scouring the internet for more information, but the closest I have come is a reference in the IBM implementation which doesn't really help me out.
Any thoughts are appreciated.

I'm trying to figure this out myself. I am using JAXM to access a web service but it wants the xml version...

Similar Messages

  • How to extract the actual XML document from soap message?

    My problem is " how to extract the actual XML document from soap message? "
    i just want to extract the attachment i.e. (pure XML document without any soap header or envolope).
    i could be ver thank full if u could solve my problem.
    [email protected]

    Hi,
    This is some skeleton code for extracting an attachment from a SOAPMessage.
    import javax.activation.DataHandler.;
    import javax.xml.soap.*;
    import javax.xml.message.*;
    Iterator allAttachments = message.getAttachments();
    AttachmentPart ap1 = null;
    while(allAttachments.hasNext()){
    ap1 = (AttachmentPart)allAttachments.next();
    //Check that the attachment is correct one. By looking at its mime headers
    //Convert the attachment part into its DOM representation:
    if(ap1.getContentType() == "text/xml"){
    //Use the activation dataHandler class to extract the content, then create a StreamSource from
    //the content.
    DataHandler attachmentContent = ap1.getDataHandler();
    StreamSource attachmentStream = new StreamSource(attachmentContent.getInputStream());
    DOMResult domAttachment = getDOMResult(attachmentStream);
    domAttachment holds an xml representation of the attachment.
    Hope this helps.

  • Need HELP passing raw SOAP to JAX-RPC Web Service

    Ive recently downloaded the web services development kit from the SUN site and have got all the examples to work fine.
    What I am now trying to do is pass RAW SOAP to the HelloWorld JAX-RPC example,
    Ive managed to get the service to call the sayHello function with no params which returns 'Hello NULL'.
    I can't however get any parameters to be passed to the sayHello function,
    Below is the existing SOAP ive got calling the function with no params.
    <?xml version="1.0"?>
    <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><sayHello xmlns="http://hello.org/wsdl">????????????</sayHello></soap:Body></soap:Envelope>
    If anybody could tell me what I need to replace ???????????? with then I would be more than gratefull.
    P.s If I changed the webservice to accept multiple arguments what would I need to put in my SOAP?
    Yours,
    Cris.

    Thanks for your help on this one. However there is still one thing I don`t understand.
    In the example SOAP I posted on the orignal message I have added the namespace ns1 pointing to
    http://hello.org/wsdl
    The example you posted goes to http://caller.org/wsdl
    below is SOAP you posted for me.
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:ns0="http://caller.org/wsdl"
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <env:Body>
    <ns0:sayHello>
    <String_1 xsi:type="xsd:string">some text</String_1>
    </ns0:sayHello>
    </env:Body>
    </env:Envelope>
    This returns me an error! However If I change ns0 to point to http://hello.org/wsdl it all works perfectly.....
    If you open a browser and go to http://hello.org/wsdl OR http://caller.org/wsdl neither URL points to anything!!!!!!! All the other namespaces used point to valid XML Schemas, which makes sense.
    So how can this SOAP message work if the namespace ns0 is nothing???????????
    Yours,
    Cris.

  • ADDING xml to the SOAP Message from client

    Hi, does anyone know how to add an xml file to the SOAP message passed by the client to the server?
    I need to send an xml file, I have already tried attachments but they dont meet the purpose. I need to send the xml as part of the soap message in AXIS 1_4.
    I read this somewhere about
    SOAPEnvelope env = message.getSOAPEnvelope;
    env.addBodyElement( new RPCElement("SOAPaccess","webservicename", new
              Object[] { }) );
    FileInputStream file = new FileInputStream( "c:\\abcd.xml");
    SOAPBodyElement aBody = new SOAPBodyElement( file );
    file.close();
    env.addBodyElement( aBody );
              However I am not certain how to go about doing this in axis.
    I have been trying to find something related to this, but havent been able to.
    Please let me know if you know how to add xml file to the body of a SOAP message.

    If anyone is interested...I got this working,
    //b is the byte form of the xml document.
    InputStream is = new ByteArrayInputStream(b);
              Document doc =XMLUtils.newDocument(is);
              SOAPElement me = new MessageElement(doc.getDocumentElement());
              SOAPElement a=message.getSOAPBody().addChildElement(me);
              MessageContext mc=_call.getMessageContext();
              mc.setMessage(message);
              mc.getMessage().getSOAPBody().detachNode();
              SOAPBody sb = (SOAPBody)mc.getMessage().getSOAPPart().getEnvelope().addBody();
              sb.addChild(new MessageElement(doc.getDocumentElement()));
              mc.getMessage().saveChanges();
              System.out.println(mc.getMessage().getSOAPPart().getEnvelope());
              SOAPEnvelope env=(SOAPEnvelope)mc.getMessage().getSOAPPart().getEnvelope();

  • Web Services with REST, SOAP and  JAX-RPC

    Hi,
    Can somebody who has developed web services extensively comment/suggest a java development environment that works best for developing web services mainly with REST. I've found that Eclipse with Axis2 and Tomcat works well. But I would like to get your opinion on it and some other alternatives.

    Hi,
    Please help me its urgent.
    can u give me a detail example how to do Web services
    with REST.
    Here is my id [email protected]
    Thanks in advance.You can do this in many ways. It depends on how heavy your service is. You can write a simple servlet that will take a REST (I'm assuming you know what REST is) request and parses it out, calls a server-side method and generates a REST response.
    Another way is to use a web-service container such as AXIS. You can read some examples and documentation on their website. AXIS2 has REST support as well.

  • Weblogic 8.1 SP 6 throws Read channel closed when sending SOAP message

    Hi,
    I am using Weblogic8.1 SP6 & Axis1 to send SOAP message through RPC call using SSL. This is working intermittently.
    I use WLSSLAdapter to set up the SSL, and some properties I set:
    System.setProperty("javax.xml.soap.MessageFactory", "weblogic.webservice.core.soap.MessageFactoryImpl");
    System.setProperty("javax.xml.rpc.ServiceFactory", "weblogic.webservice.core.rpc.ServiceFactoryImpl");
    System.setProperty("weblogic.webservice.verbose", "true");
    In case of error, the server throws this:
    java.io.IOException: Read channel closed
    at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Sourc
    e)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown S
    ource)
    at com.certicom.tls.record.ReadHandler.read(Unknown Source)
    at com.certicom.tls.record.ReadHandler.read(Unknown Source)
    at com.certicom.tls.record.ReadHandler.read(Unknown Source)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.closeWriteHandler(Unknown S
    ource)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.close(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
    at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Sourc
    e)
    at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown S
    ource)
    at com.certicom.tls.record.WriteHandler.write(Unknown Source)
    at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:66)
    at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
    AT java.io.FilterOutputStream.write(FilterOutputStream.java:80)
    at weblogic.webservice.binding.soap.HttpClientBinding.writeToStream(HttpClientB
    inding.java:430)
    at weblogic.webservice.binding.soap.HttpClientBinding.send(HttpClientBinding.ja
    va:219)
    at weblogic.webservice.core.handler.ClientHandler.handleRequest(ClientHandler.j
    ava:37)
    at weblogic.webservice.core.HandlerChainImpl.handleRequest(HandlerChainImpl.jav
    a:143)
    at weblogic.webservice.core.ClientDispatcher.send(ClientDispatcher.java:231)
    at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:143
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:471)
    at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:457)
    at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:566)
    at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:419)
    Before sending message, application will first retrieve WSDL from the target. This is always success.
    I need to know how to fix this problem.
    Any help is appreciated. Thanks.
    Alvin

    Hi,
    Even I am facing the same issue could any body help me out to solve this issue.

  • JAX-RPC whitepaper available on dev2dev

    The Java API for XML-based remote procedure calls (JAX-RPC) simplifies
    the process of building Web services that incorporate XML-based RPC.
    Rajesh Sumra looks at how developers can use JAX-RPC to implement and
    call SOAP-based Web services described by the Web Services Description
    Language (WSDL) on the BEA WebLogic Platform.
    http://dev2dev.bea.com/articles/Sumra.jsp

    et al
    http://dev2dev.bea.com/technologies/webservices/index.jsp
    Bruce Stephens wrote:
    >
    The Java API for XML-based remote procedure calls (JAX-RPC) simplifies
    the process of building Web services that incorporate XML-based RPC.
    Rajesh Sumra looks at how developers can use JAX-RPC to implement and
    call SOAP-based Web services described by the Web Services Description
    Language (WSDL) on the BEA WebLogic Platform.
    http://dev2dev.bea.com/articles/Sumra.jsp

  • Problem to serialise the soap message in a handler

    I'm using a sun web service with a handler on the server side.
    In this handler I want to analize the soap message.
    First I try to serialize it :
    public boolean handleRequest(MessageContext arg0) {
        SOAPMessageContext context = SOAPMessageContext) arg0;
        SOAPMessage mes = context.getMessage();
        Document doc= mes.getSOAPPart();
        OutputFormat format = new OutputFormat(doc);
        format.setLineSeparator(LineSeparator.Windows);
        format.setIndenting(true);
        format.setLineWidth(0);            
        format.setPreserveSpace(true);
        StringWriter sw = new StringWriter();
        XMLSerializer serializer = new XMLSerializer(sw , format);
        serializer.asDOMSerializer();
        serializer.serialize(doc);             
        System.out.println(sw.toString());
    }The result I get looks like that :
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope><soapenv:Header>
    Where are the namespaces ?
    This xml is not correct because the soapenv prefix is not bound.
    How can I get a correct xml from the SOAP message ?

    Hi,
    Is ZYBTT a new attribute? Have you changed the status of the attribute to implemented or released (in SWO1: Edit -> Change release status)?
    And actually I think that your syntax is wrong too (BOR world is different compared to classes). If you want to use an attribute, I think that the syntax should be something like this:
    SWC_GET_PROPERTY <Object> <Attribute> <AttributeValue>.
    Read more here:
    http://help.sap.com/saphelp_nw04/helpdata/en/c5/e4acef453d11d189430000e829fbbd/content.htm
    Regards,
    Karri

  • Intercepting SOAP XML message in JAX-RPC Handler and calling a diff method

    Is it possible to intercept the SOAP XML message in the JAX-RPC handler and avoid the serialization and deserialization (OR avoid XML data binding)
    Here is a more detail question
    My web service has two methods
    1. One Method which accepts Java Object (this object is mapped with a Schema
    Complex Type Element in my WSDL file)
    2. Second method which accept simple String type.
    I want my web service client to send java object (using the first method), so that the Input gets validate in the WSDL itself (before it hits the actual web service) but once the request gets validated i want to pass that converted SOAP XML String (on the Server side using JAX-RPC handler) to the Second method.

    The answer to this is that the WSDL had
    elementFormDefault="qualified"
    in the schema.
    Changing to unqualified resulted in the desired output.
    Note: The service was changed to handle both cases.

  • Store-and-forward SOAP messaging in JAX-RPC ??

    JAXM seems dead (although SAAJ lives and is very useful). I want to implement a store-and-forward SOAP messaging system for EAI and give it a Java API. Can I do this in JAX-RPC? Does it make any sense?
    Thanks,
    Mark

    At Java One they were advocating the use of web services over JMS.

  • Web Service JAX-RPC/SOAP with JAXB

    Hello,
    During my research on JAX-RPC/SOAP as web service technology. I found only simple "helloworld" sample type what using simple String as aurgment. For my task, I required a more complex aurgment such as a complete contact info. I then did some sample code for JAXB and found it to be very useful as a XML/JAVA binding tool. It seems logical to use JAXB to parse and bind the complex aurgment. Though I have not seen any reference to this using it with JAX-RPC. Does JAX-RPC have the tool set to accomplish the same thing? JAX-RPC may have such thing, but using this JAXB seem logical, thus would I still "conform" to the JAX-RPC if I go this route. Any info would be much appreciative.
    Thanks in Advance,
    Mike

    The two JAX-RPC tools that I have used, the reference implementation and Apache Axis both have tools for mappiing XML to classes and vice-versa. Having used JAXB also, I have to say that both of these tools are much easier to use than JAXB.
    As far as whether it will conform, you can make a valid SOAP message using any tool you like.

  • How to bind soap header using jax-rpc

    To Whom It May Concern:
    I am using Rad7, Ibm Websphere 6.1, on Windows XP.
    I created an SoapHeader first using a string and bind it using jax-ws.
    It works for jax-ws but unfortunately, my work services uses jax-rpc.
    Does anybody know how to bind the soap header using jax-rpc.
    Any help or hint would be greatly appreciated it.
    Here is my code:
    import org.apache.cxf.headers.Header;
    import org.apache.cxf.headers.Header.Direction;
    import org.apache.cxf.helpers.DOMUtils;
    import org.apache.cxf.binding.soap.SoapHeader;
    import javax.xml.namespace.QName;
    import java.io.StringReader;
    import java.util.List;
    import java.util.ArrayList;
    import javax.xml.ws.BindingProvider;
                   @Test
         public void testService() throws Exception {     
                   try
                        URL wsdlURL = new URL("http://localhost:9087/abc/services/ServiceABCService");
                        ServiceRequestServiceService service = new ServiceRequestServiceServiceLocator();
                        ServiceRequestService port = service.getServiceRequestService(wsdlURL);
                   //How to Add Soap Header using jax-ws
              String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><ABCHdrRq "
              + "xmlns=\"http://xmlns.ABCgc.net/ABC/2002/header/\" "
              + ">"
              + "<version>1.0</version><srcInfo><chType>abc</chType><chInst>0124</chInst>" +
                        "<appName>sSAR</appName><hostName>DW70210521</hostName><userId>fxue</userId>" +
                        "</srcInfo><startTimeStamp>2010-06-04T13:44:45.132</startTimeStamp><clientDt>2010-06-04T13:44:53.242</clientDt><serviceInfo><serviceName>ServiceRequestService</serviceName>" +
                        "<serviceFunc>addServiceRequest</serviceFunc></serviceInfo>" +
                   "<prevTransInfo><prevRqUID>BORS2010-06-04T13:41:10.2067f9368d1-8c5c</prevRqUID>" +     
                   "<prevRespTimestamp>2010-06-04T13:41:10.871</prevRespTimestamp>"+
                   "<prevRespEndTimestamp>2010-06-04T13:41:10.902</prevRespEndTimestamp>+</prevTransInfo>"+
                   "</ABCHdrRq>";
              SoapHeader dummyHeader1 = new SoapHeader(new QName("uri:http://xmlns.ABCgc.net/ABC/2002/header/", "ABCHdrRq"),
              DOMUtils.readXml(new StringReader(xml)).getDocumentElement());
              dummyHeader1.setDirection(Direction.DIRECTION_OUT);
              List<Header> headers = new ArrayList<Header>();
                   headers.add(dummyHeader1);
                   ((BindingProvider)port).getRequestContext().put(Header.HEADER_LIST, headers);
                   //How to Add Soap Header to the request using jax-ws
                   catch(Exception e)
                        System.out.println("Exception message:"+e.getMessage());
    Yours,
    Frustrated

    Well, how an attachment is processed depends on your application logic...if your application logic requires to processing attachments and verify it before processing the SOAP message, handlers could be better option.
    If you need to process the attachment while processing the SOAP message, you can do it in the service implementation class.
    In both the cases you need to get access to SOAPMessage object and from there get the attachments with getAttachments method.

  • How to pass SOAP Attachments with JAX-RPC Web Service

    I'm confused...
    This sample shows how to send/receive SOAP attachments by using the JAX-RPC Handler mechanism. Can somebody confirm if this is the preferred way to do this. I've seen an example wich does something like:
      public interface AttachmentService extends Remote {
        public String storeDocumentService(javax.activation.DataHandler dh, String filename) throws RemoteException;
      }and then uses JAX-RPC utilities to create wsdl, stubs and stuff. Does this have the same result, as what the OTN example shows (from an architecture perspective?
    Thx,
    Jan.

    Well, how an attachment is processed depends on your application logic...if your application logic requires to processing attachments and verify it before processing the SOAP message, handlers could be better option.
    If you need to process the attachment while processing the SOAP message, you can do it in the service implementation class.
    In both the cases you need to get access to SOAPMessage object and from there get the attachments with getAttachments method.

  • JAX-RPC Asynchronous messaging

    I am attempting to create a publish / subscribe service using JAX-RPC (since remote procedure calls are needed through most of the program)... however I have not found any good descriptions / explainations on how to create the remote messaging from the publisher (server) to the consumer (client)... I know this is the JMS forum but there is not a forum dedicated to JAX or SOAP... so I figured this would be the closet one and maybe someone here has experimented with something similar... thanks

    There's a brand new forum for Java and Web services, including JAX-RPC.
    I'm sure folks there can give you a hand.
    http://forum.java.sun.com/forum.jsp?forum=331

  • Help, how to monitor the soap message sent by JAX-WS

    Hi,everyone:
    I want to monitor the soap message sent by JAX-WS using apache TCPMon.
    For example, the JAX-WS is deployed on port 8080 , I make TCPMon listening on port 4444 and send soap request to port 4444 using JAX-WS.
    Code in client:
    @WebServiceClient(name = "JAX_WS", targetNamespace = "http://www.example.org/JAX_WS/", wsdlLocation = "file:/E:/zwz/EclipseWorkspace/JAX_WSDemo/WebRoot/META-INF/JAX_WS.wsdl")
    public class JAXWS_Service extends Service {
         private final static URL JAXWS_WSDL_LOCATION;
         private final static Logger logger = Logger
                   .getLogger(demo.client.JAXWS_Service.class.getName());
         static {
              URL url = null;
              try {
                   //URL baseUrl;
                   //baseUrl = demo.client.JAXWS_Service.class.getResource(".");
                   url = new URL("http://localhost:4444/JAX_WSDemo/JAXWSBean");
              } catch (MalformedURLException e) {
                   logger
                             .warning("Failed to create URL for the wsdl Location: 'file:/E:/zwz/EclipseWorkspace/JAX_WSDemo/WebRoot/META-INF/JAX_WS.wsdl', retrying as a local file");
                   logger.warning(e.getMessage());
              JAXWS_WSDL_LOCATION = url;
         public JAXWS_Service(URL wsdlLocation, QName serviceName) {
              super(wsdlLocation, serviceName);
         public JAXWS_Service() {
              super(JAXWS_WSDL_LOCATION, new QName("http://www.example.org/JAX_WS/","JAXWSBeanService"));  //JAX_WS
         @WebEndpoint(name = "JAX_WSPort")
         public JAXWS getJAXWSSOAP() {
              return super.getPort(new QName("http://www.example.org/JAX_WS/","JAX_WSPort"), JAXWS.class);  //JAX_WSSOAP
    }But i get the exception:
    Exception in thread "main" com.sun.xml.internal.ws.wsdl.parser.InaccessibleWSDLException: 2 counts of InaccessibleWSDLException.
    java.net.SocketException: Unexpected end of file from server
    java.net.SocketException: Unexpected end of file from serverAnd the TCPMon doesn't receive anything.
    If i use Axis2, the TCPMon will work fine.
    I cannot figure out how to configure the webservices.
    Could anyone help me? Thanks a lot.

    [http://blog.vinodsingh.com/2007/02/monitor-soap-messages.html|http://blog.vinodsingh.com/2007/02/monitor-soap-messages.html]
    Edited by: vinod.singh on 7 Apr, 2009 11:03 AM

Maybe you are looking for