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.

Similar Messages

  • 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.

  • How to generate soap header using java code

    Hi,
    I need to generate the following soap header using java DOM.
    Can you send me some java code snippet to do so?
    <soapenv:Header>
    <api:RequesterCredentials soapenv:mustUnderstand="0" xmlns:api="urn:ThinkPod:api:ThinkPodAPI" xmlns:ebl="urn:ThinkPod:apis:eBLBaseComponents">
    <ebl:ThinkPodAuthToken>YourToken</ebl:ThinkPodAuthToken>
    <ebl:Credentials>
    <ebl:DevId>YourDevId</ebl:DevId>
    <ebl:AppId>YourAppId</ebl:AppId>
    <ebl:AuthCert>YourAuthCert</ebl:AuthCert>
    </ebl:Credentials>
    </api:RequesterCredentials>
    </soapenv:Header>

    You want to generate that on a mobile device or how is that related to CLDC and MIDP?

  • How to create SOAP Header elements using SAAJ??

    I am facing a problem when adding header elements under SOAP Header
    using SAAJ(api).
    I want to create a structure as following:
    I get a empty SOAP header obejct by writing code--> SOAPHeader header
    = envelope.getHeader();
    But not able to add SOAP header elements as specified in example
    below. I tried but its giving me error as
    "HeaderElements must be namespace qualified"
    CAN ANYBODY TELL ME THAT HOW TO ADD HEADER ELEMENTS USING SAAJ??
    <SOAP:Header>
    <AccountNumber>123</AccountNumber>
    <AuthorisationCode>test111</AuthorisationCode>
    <Source>abc</Source>
    <Market>01</Market>
    </SOAP:Header>

    I'm including this comment from some code I've just written after wrestling with this for hours (I've actually left it on another post as well). The upshot of it all is that you have to include a namespace URI when creating a header in SAAJ:
            NOTE: SOAP 1.1 requires that all header entries be namespace-qualified to
            namespace URI's.  The SAAJ 1.2 implementation requires a Name object with
            the namespace URI to make this happen even if the prefix used is already
            visible by being declared higher in the document (e.g. in the Envelope).
            However, the namespace URI is not present in the serialized header element
            as long as it was declared higher in the document.  In order to create a
            header element without a prefix (to conform to a web service definition
            that doesn't use a prefix in its headers, for example), leave the prefix
            null in the addHeaderElement() method. 
            For example, with a SOAPHeader 'hdr':
              //first create the name
              Name name = env.createName("my-local-name", null, "my-URI");
              //then create the header element
              SOAPHeaderElement he = hdr.addHeaderElement(name);
            This would result in an XML element that looked like this:
              <my-local-name xmlns="my-URI"/>
            This would allow SAAJ developers to create a header for a service that
            only expected a local name in its header elements (as many do!).  As long
            as the service doesn't choke on the attribute (validation!  evil!), this
            should work.
                                                        Rob Kemmer
                                                        01/12/2005
     

  • ClassCastException in my WS over JMS using JAX-RPC in WLS 10.3...

    Hi,
    I am developing a WS over JMS using JAX-RPC in WLS 10.3 (I tried both WLS 10.3.0 and 10.3.1). And when WLS is trying to marshal the response, it throws "ClassCastException":
    ava.lang.ClassCastException: org.tmforum.mtop.nrf.xsd.com.v1.EquipmentHolderEnumType cannot be cast to java.lang.String
    at com.bea.staxb.runtime.internal.StringTypeConverter.print(StringTypeConverter.java:45)
    at com.bea.staxb.runtime.internal.SimpleContentBeanMarshaller.print(SimpleContentBeanMarshaller.java:52)
    at com.bea.staxb.runtime.internal.RuntimeBindingProperty.getLexical(RuntimeBindingProperty.java:154)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeCharData(PushMarshalResult.java:639)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:413)
    at com.bea.staxb.runtime.internal.SimpleContentRuntimeBindingType.accept(SimpleContentRuntimeBindingType.java:46)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:403)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:403)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:400)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:403)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:400)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:403)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:400)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:403)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalType(PushMarshalResult.java:153)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visitProp(PushMarshalResult.java:631)
    at com.bea.staxb.runtime.internal.PushMarshalResult.visit(PushMarshalResult.java:403)
    at com.bea.staxb.runtime.internal.ByNameRuntimeBindingType.accept(ByNameRuntimeBindingType.java:89)
    at com.bea.staxb.runtime.internal.PushMarshalResult.writeContents(PushMarshalResult.java:195)
    at com.bea.staxb.runtime.internal.PushMarshalResult.marshalTopType(PushMarshalResult.java:96)
    at com.bea.staxb.runtime.internal.MarshallerImpl.marshalBindingType(MarshallerImpl.java:302)
    at com.bea.staxb.runtime.internal.MarshallerImpl.marshalElement(MarshallerImpl.java:383)
    at weblogic.wsee.bind.runtime.internal.LiteralSerializerContext.marshalElement(LiteralSerializerContext.java:82)
    at weblogic.wsee.bind.runtime.internal.BaseSerializerContext.internalSerializeElement(BaseSerializerContext.java:197)
    at weblogic.wsee.bind.runtime.internal.BaseSerializerContext.serializeElement(BaseSerializerContext.java:128)
    at weblogic.wsee.codec.soap11.SoapEncoder.encodePart(SoapEncoder.java:322)
    at weblogic.wsee.codec.soap11.SoapEncoder.encodeReturn(SoapEncoder.java:228)
    at weblogic.wsee.codec.soap11.SoapEncoder.encodeParts(SoapEncoder.java:215)
    at weblogic.wsee.codec.soap11.SoapEncoder.encode(SoapEncoder.java:134)
    at weblogic.wsee.codec.soap11.SoapCodec.encode(SoapCodec.java:134)
    at weblogic.wsee.ws.dispatch.server.CodecHandler.encode(CodecHandler.java:104)
    at weblogic.wsee.ws.dispatch.server.CodecHandler.handleResponse(CodecHandler.java:51)
    at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:287)
    at weblogic.wsee.handler.HandlerIterator.handleResponse(HandlerIterator.java:271)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.callHandleResponse(ServerDispatcher.java:341)
    at weblogic.wsee.ws.dispatch.server.ServerDispatcher.dispatch(ServerDispatcher.java:189)
    at weblogic.wsee.ws.WsSkel.invoke(WsSkel.java:80)
    at weblogic.wsee.server.jms.JmsWebservicesMessageDispatcher.dispatchMessage(JmsWebservicesMessageDispatcher.java:175)
    at weblogic.wsee.server.jms.JmsQueueListener.processMessage(JmsQueueListener.java:397)
    at weblogic.wsee.server.jms.JmsQueueListener.onMessage(JmsQueueListener.java:392)
    at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4585)
    at weblogic.jms.client.JMSSession.execute(JMSSession.java:4271)
    at weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:3747)
    at weblogic.jms.client.JMSSession.access$000(JMSSession.java:114)
    at weblogic.jms.client.JMSSession$UseForRunnable.run(JMSSession.java:5096)
    at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:516)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    The "EquipmentHolderEnumType" is generated JAXB object (obviously it is not a String) from WSDL using WLS wsld generation. And here is how that Enum is defined in XSD:
    <xsd:simpleType name="EquipmentHolderEnumType">
    <xsd:annotation>
    <xsd:documentation>
    <p>Equipment holder type</p>
    </xsd:documentation>
    </xsd:annotation>
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="MINOR_EXT"/>
    <xsd:enumeration value="rack"/>
    <xsd:enumeration value="shelf"/>
    <xsd:enumeration value="sub_shelf"/>
    <xsd:enumeration value="slot"/>
    <xsd:enumeration value="sub_slot"/>
    <xsd:enumeration value="remote_unit"/>
    <xsd:enumeration value="remote_slots"/>
    </xsd:restriction>
    </xsd:simpleType>
    My question is why WLS is trying to cast the EnumType to String when marshalling it? How can I fix this exception?
    Also, second question: my WS will take some time to get the response ready (1+ minute). I was using WLS console test client to test my WS. And the test client always got time out:
    java.io.IOException: Request timed out
    at weblogic.wsee.connection.transport.jms.JmsTransport.receive(JmsTransport.java:356)
    at weblogic.testclient.WebServiceOperation.invokeJms(WebServiceOperation.java:463)
    at weblogic.testclient.WebServiceOperation.addWeblogicHeadersAndInvoke(WebServiceOperation.java:382)
    at weblogic.testclient.WebServiceOperation.invokeComplex(WebServiceOperation.java:305)
    at weblogic.testclient.WebServiceOperation.invoke(WebServiceOperation.java:626)
    How can I configure the WLS console test client so that I can increase teh timeout setting for the client?
    Thank you very much!
    Jian

    Hi, pls how did you solve your problem exatly? Because I have similar problem without solution.
    I have WSDL contract like:
    <xs:element name="duration">
    <xs:complexType>
    <xs:simpleContent>
    <xs:extension base="durationType">
    <xs:attribute name="days" type="xs:int" use="optional"/>
    </xs:extension>
    </xs:simpleContent>
    </xs:complexType>
    </xs:element>
    <xs:simpleType name="durationType">
    <xs:restriction base="xs:string">
    <xs:enumeration value="PERIODIC"/>
    <xs:enumeration value="PERPETUAL"/>
    <xs:enumeration value="CREDIT_DAYS"/>
    </xs:restriction>
    </xs:simpleType>
    And client site generated by WLS ant task "generate-from-wsdl" with "JAXRPC" option and when I use calling of this client and exeption was appeared:
    FaultString [com.company.DurationType] FaultActor [null] Detail [<detail><java:string>java.lang.ClassCastException: com.company.DurationType</java:string></detail>];
    Note: all other messages are correct.
    thx

  • XML Parser Error while creating Web service Client using JAX RPC

    hello evryone,
    Im facing XML Parser Error while creating web service client using JAX RPC. Im using Net Beans IDE for development purpose. I have wrote configuration file for client. Now i want to create Client stub. However i dont know how to do this in Net Beans. So i tried to do it from Command promt using command :
    wscompile -gen:client -d build -classpath build config-wsdl.xml
    here im getting Error:
    error parsing configuration file: XML parsing error: com.sun.xml.rpc.sp.ParseException:10: XML declaration may only begin entities
    Please help me out.
    Many thanks in advance,
    Kacee

    Can i use the client generated using jdeveloper 11g to import into the oracle forms 10g, i.e., form builder 10g. Currently this is the version we have in our office.

  • Sending attachments using JAX-RPC

    Hi,
    can anyone give me an example for sending an attachment using JAX-RPC. I want to create a webservice that will expect an attachment. Also once the client snds the attachment how can i access it in the service?
    any help will be apreciated. Thanks.

    Did anyone test this?
    I am using a DataHandler in the server
    public String sendDocument(String name, DataHandler dh)
    DataHandler rdh = (DataHandler) dh;
         if (dh == null)
              return message+ "Received null attachment";
         DataSource ds = rdh.getDataSource();
         try
              dh.writeTo(new FileOutputStream("D:\\temp\\" + name));
         catch(java.io.IOException e)
         return message + " Processed attachment " + ":Stream Error: " + e.getMessage();
         return message + " Processed attachment" ;
    In the client I use Proxy which works fine:
    FileDataSource fs = new FileDataSource(fileName);
    if (fs == null)
         System.out.println("Invalid File Source");
    DataHandler dhSource = new DataHandler(fs);
         System.out.println(up.sendDocument(dhSource.getName(), dhSource));
    THIS WORKS FINE. I see the attachment is saved properly.
    When I try using DII:
    call.setOperationName(new QName(BODY_NAMESPACE_VALUE,"sendDocument"));
    QName QNAME_TYPE_DH = new QName(NS_XSD, "DataHandler");
    call.addParameter("String_1", QNAME_TYPE_STRING,ParameterMode.IN);
    call.addParameter("DataHandler_1", QNAME_TYPE_DH,ParameterMode.IN);
    FileDataSource fs = new FileDataSource(fileName);
    if (fs == null)
         System.out.println("Invalid File Source");
    else
              DataHandler dhSource = new DataHandler(fs);
              String dhName = dhSource.getName();
         Object[] params = new Object[] {dhName,dhSource};
         String result = (String)call.invoke(params);
         System.out.println(result);
    THIS DOES NOT WORK. I get an error.
    [java] serialization error: no serializer is registered for (class javax.activation.DataHandler, {http://www.w3.org/2001/XMLSchema}DataHandler)
    ANY POINTERS??????
    I even tried this:
    QName qnameAttachment = new QName(NS_XSD, "DataHandler");
    TypeMappingRegistry tr = service.getTypeMappingRegistry();
    TypeMapping tm = tr.createTypeMapping();
    tm.register(DataHandler.class,
    qnameAttachment,
    new JAFDataHandlerSerializerFactory(),
    new JAFDataHandlerDeserializerFactory());
         tr.registerDefault(tm);
    NO SUCCESS!
    Appreciate any responses....

  • Using JAX-RPC handlers to proxy web service traffic

    Hi,
    I want to use JAX-RPC handlers to proxy web service traffic. In some instances the handler should modifiy / verify the message before forwarding the request to the remote web service end-point. Hence, the handler should forward the call by invoking the remote web service. In some cases the result from invoking the remove service should be post-processed by another proxy handler. To ensure that the result from invoking the remote service is available for post-processing I assume that the handler invoking the remote service must add the response message to the message context ( e g setProperty method) in the handler. Is this correctly understood?
    I would like to understand that this is a technically feasible and reasonable approach of using JAX-RPC. I'd really appreciate some feedback here.
    Many thanks,
    Tom

    Hi Eric,
    Thanks for your response. we are trying to access WSRR( manages end point urls for 7 different environments) and generate the end point dynamically at the design time. As we figured out WSRR is not compatible with OSB we are trying to implement these client side (OSB Proxy service) handlers which would get the dynamic endpoint depending on the environment used. I was able to create the handlers for this and set the jar in the classpath but the client service which should be using these handlers have to have these handlers defined in the deployment descriptor(web.xml) which am unable to see with a OSB project.
    Will there be a deployment descriptor(web.xml/webservices.xml) associated with Proxy services on OSB? Or Is there any other way to add custom JAX-RPC Handlers to a proxy service? Or is there any way to connect to WSRR directly?
    Thanks,
    Swetha

  • Attachments using JAX - RPC

    I am using JAX - RPC for attachemnts using jwsdp-1.2. I am using DataHandler for attachments. I have been able to deploy the web service but when I try to connect to web service using client, I get following error. ny help will be greatly appreciated
    serialization error: java.lang.NullPointerException
    at com.sun.xml.rpc.encoding.AttachmentSerializer.serializeAsAttachment(AttachmentSerializer.java:120)
    at com.sun.xml.rpc.encoding.AttachmentSerializer.serialize(AttachmentSerializer.java:74)
    at com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.serialize(ReferenceableSerializerImpl.java:71)
    at attachments.client.AttachmentExampleAPI_sendDocument_RequestStruct_SOAPSerializer.doSerializeInstance(AttachmentExampleAPI_sendDocument_RequestStruct_SOAPSerializer.java:88)
    and more lines of error.
    Below is my client and webservice code :
    CLIENT
    FileDataSource fs = new FileDataSource("abc.txt");
    DataHandler dhSource = new DataHandler(fs);
    AttachmentExampleAPI up = new TestService_Impl().getAttachmentExampleAPIPort();
    up.sendDocument("properties", dhSource));
    WEBSERVICE CODE
    public void sendDocument(String name, DataHandler dh) throws java.rmi.RemoteException {
    DataSource ds = rdh.getDataSource();
    dh.writeTo(new FileOutputStream("abc.txt" ));
    Any help regarding the error will be great.

    Not sure exactly what the problem is but i have sent attachements successfully from the server to client using:
    SERVER method:
    public javax.activation.DataHandler getAudioMIMEAttachment(java.lang.String in0, java.lang.String in1) throws java.rmi.RemoteException {
    String inputFilename = null;
    String inputFormat = null;               
    inputFilename = "C:\\wav\\" + in0 + "." + in1;
    System.out.println("You have requested the following file: " + inputFilename);
    //create a new DataHandler object for the file contents
    DataHandler dh = new DataHandler(new FileDataSource(new File(inputFilename)));
    return dh;                    
    Chunks from client code:
    StreamingMultimediaSoapBindingStub stub = null;
    try
    stub = (StreamingMultimediaSoapBindingStub)(new StreamingDemoServiceLocator().getPort(StreamingMultimediaSoapBindingStub.class));
    catch (javax.xml.rpc.ServiceException jre) {
    System.err.println("Could not get client stub.");
    jre.printStackTrace();
    //call for binary DataHandler attachment
    if(stub != null)
    try
    dh = stub.getAudioMIMEAttachment("long", "wav");                                   
    catch (java.rmi.RemoteException re) {
    System.err.println("Error whilst calling method on client stub.");
    re.printStackTrace();                                   
    Well, hope it helps
    regards
    Paul

  • How to set SOAP Header When Calling Business Service (OSB) Using Split-Join

    Hi,
    We need to call WSDL based webservice which requires heading static content for successful call. As we need to call the same service parallely, hence we want to use Split-Join.
    Looked at couple of forum links, noted that we can't play with headers while working with Split-Join.
    For curiosity, just want to check any option other than using proxy as mediator in setting header information.
    Regards
    Venkata Madhu

    Venkata,
    You still have the option, if you hv n't tried this one.
    To enable this capability, you must declare the header parts along with the body parts in a single request/response message in the Split-Join WSDL and in the WSDL of the proxy or business services invoked by the Split-Join. With the message parts declared in the WSDLs, SOAP header content is available to Split-Joins in the request/response message variables.
    Following is an example of the message and binding definitions in the WSDL.
    Message
    <wsdl:message name="retrieveCustomerOverviewByIdRequestMessage">
    <wsdl:part name="retrieveCustomerOverviewByIdRequest"
    element="co:retrieveCustomerOverviewByIdRequest"/>
    *<wsdl:part name="serviceContext" element="sc:serviceContext"/>*
    </wsdl:message>
    Binding
    <wsdl:input>
    <soap:body use="literal" parts="retrieveCustomerOverviewByIdRequest"/>
    *<soap:header message="tns:retrieveCustomerOverviewByIdRequestMessage"part="serviceContext" use="literal"/>*
    </wsdl:input>
    hope it helps !!
    Regards,
    Abhinav

  • How to go from a .wsdl to .war file to deploy on Tomcat ? (using jax-rpc?)

    I have created a .wsdl file using XMLSpy and I want to deploy the service on tomcat. I have been unsuccessful in using the "wscompile -import" option.
    Does anyone know how to cross-compile a .wsdl file into a .war so it can be deployed on tomcat? If there is another way other than a .war file, that is fine too...
    Currently, I am using WSDL2Java tool by Apache Axis. I take my .wsdl file use the WSDL2Java tool to get the java files, Then I run the java files through wscompile, wsdeploy etc.... the problem with this approach is that the .wsdl file produced by the wsdeploy does not support the document encoding (everything switched to rpc) and no literal either (I think).
    If anyone has figured out a better way of going from .wsdl to java or .war or tomcat.. please let me know.. I'm running out of options...
    Thank you !

    The link worked correctly for me. You can also refer to a recently published whitepaper at
    https://jax-rpc.dev.java.net/whitepaper/1.1/index-part1.html. Scenario 5 in second part (https://jax-rpc.dev.java.net/whitepaper/1.1/index-part2.html#Scenario5) of the whitepaper describes how to achieve your scenario.
    Post your JAX-RPC related questions to [email protected] for a quicker resolution.
    Send an email to [email protected] to subscribe to the alias.
    Send an mail to [email protected] for a complete list of help commands.
    Thanks for your interest in JAX-RPC.
    Regards,
    -Arun

  • How to access SOAP header without using SOAP message handler

    I have a requirement to retrieve SOAP header information within each web services operation. So I can't use SOAP message handler. Is there any way to do that? BTW, I am not using workshop.
    Thanks.

    Howeve how can I put data into soap header in UDF? DynamicConfiguration won't work for soap header, right?
    Which data do you want ot put into the Header section.
    ASMA or Dynamic Configuration is used to read/ put the details from/ into the header elements.....
    Refer: http://help.sap.com/saphelp_nw04/helpdata/en/43/0a7d1be4e622f3e10000000a1553f7/frameset.htm
    From the help section:
    This information is not located in the payload of the message, but in additional message header fields.
    Regards,
    Abhishek.

  • Use JAX-RPC or SAAJ service?

    As far as I know we can set up web service with JAX-PRC or SAAJ.
    It seems that SAAJ is simpler than JAX-RPC for me, because it don't need to use WSDL.
    Is there any difference between them? How to choose between them?
    Please help!
    Thanks in advance!

    Hi,
    You should choose SAAJ in the case where the client has absolute knowledge of the SOAP messages that the web service receives and sends, and there is no reason for it to parse a WSDL in order to discover the web service's specification.
    You should choose JAX-RPC in the case where the client knows nothing about the web service at runtime, and it needs to dynamically construct the call to it.
    As far as complexity is concerned, i believe that JAX-RPC is much simpler than SAAJ, because it gives the programmer a simple API that wraps everything concerning the SOAP messages and their complexity. The programmer does not have to manually construct or parse the SOAP message. Instead, he just makes a rpc with the appropriate parameter values.
    I hope i helped
    Regards

  • How to generate a soapFault from jax-rpc hander

    Hello,
    I'm building a custom authentication jax-rpc handler (OAS 10.1.3.1) that is supposed to make the service to return a fault if some conditions are not met.
    Here is what we need to return:
    <Fault><faultcode>invalidIP</faultcode><faultstring>IP is not known</faultstring><faultactor></faultactor></Fault>
    I tried to throw a SOAPFaultException, but all the is returned back is the original SOAP request.
    How should it be implemented?
    if ( !res ) {
    Detail detail = null;
    try{
    detail = SOAPFactory.newInstance().createDetail();
    }catch(SOAPException ex){
    ex.printStackTrace();
    throw new javax.xml.rpc.soap.SOAPFaultException(
    new javax.xml.namespace.QName("env.Server"),
    "IP is not known", "NO ACTOR", detail);
    }

    Hello ,
    I think you need to use the Work item Change set
    cube of TFS .You need to go through the below page
    http://msdn.microsoft.com/en-us/library/ms244678.aspx
    Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/

  • Unable to call the service using JAX-RPC

    Hi,
    I created a web service in Weblogic6.1 using the ant wsgen utility.
    When i tried to invoke the service using my client program, i get the following error.
    Exception in thread "main" modeler error: model error: invalid entity name: "string" (in namespace: "http://www.w3.org/1999/XMLSchema"
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:137)
    at com.sun.xml.rpc.processor.config.ModelInfo.buildModel(ModelInfo.java:77)
    at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:96)
    at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildServiceInfo(ServiceInfoBuilder.java:59)
    at com.sun.xml.rpc.client.dii.ConfiguredService.<init>(ConfiguredService.java:44)
    at com.sun.xml.rpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:32)
    at JAXRPCClient.main(JAXRPCClient.java:20)
    CAUSE:
    model error: invalid entity name: "string" (in namespace: "http://www.w3.org/1999/XMLSchema")
    at com.sun.xml.rpc.processor.schema.InternalSchemaBuilder.buildTypeDefinition(InternalSchemaBuilder.java:61)
    at com.sun.xml.rpc.processor.schema.InternalSchema.findTypeDefinition(InternalSchema.java:45)
    at com.sun.xml.rpc.processor.modeler.wsdl.SchemaAnalyzer.schemaTypeToSOAPType(SchemaAnalyzer.java:66)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.processSOAPOperationRPCStyle(WSDLModeler.java:592)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.processSOAPOperation(WSDLModeler.java:423)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.processPort(WSDLModeler.java:344)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.processService(WSDLModeler.java:231)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:196)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:103)
    at com.sun.xml.rpc.processor.config.ModelInfo.buildModel(ModelInfo.java:77)
    at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:96)
    at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildServiceInfo(ServiceInfoBuilder.java:59)
    at com.sun.xml.rpc.client.dii.ConfiguredService.<init>(ConfiguredService.java:44)
    at com.sun.xml.rpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:32)
    at JAXRPCClient.main(JAXRPCClient.java:20)
    CAUSE:
    invalid entity name: "string" (in namespace: "http://www.w3.org/1999/XMLSchema")
    at com.sun.xml.rpc.wsdl.framework.AbstractDocument.find(AbstractDocument.java:110)
    at com.sun.xml.rpc.processor.schema.InternalSchemaBuilder.buildTypeDefinition(InternalSchemaBuilder.java:54)
    at com.sun.xml.rpc.processor.schema.InternalSchema.findTypeDefinition(InternalSchema.java:45)
    at com.sun.xml.rpc.processor.modeler.wsdl.SchemaAnalyzer.schemaTypeToSOAPType(SchemaAnalyzer.java:66)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.processSOAPOperationRPCStyle(WSDLModeler.java:592)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.processSOAPOperation(WSDLModeler.java:423)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.processPort(WSDLModeler.java:344)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.processService(WSDLModeler.java:231)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:196)
    at com.sun.xml.rpc.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:103)
    at com.sun.xml.rpc.processor.config.ModelInfo.buildModel(ModelInfo.java:77)
    at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.getModel(ServiceInfoBuilder.java:96)
    at com.sun.xml.rpc.client.dii.ServiceInfoBuilder.buildServiceInfo(ServiceInfoBuilder.java:59)
    at com.sun.xml.rpc.client.dii.ConfiguredService.<init>(ConfiguredService.java:44)
    at com.sun.xml.rpc.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:32)
    at JAXRPCClient.main(JAXRPCClient.java:20)
    My wsdl file is
    - <definitions targetNamespace="java:com.mountain.molehill.ejb.controller" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:tns="java:com.mountain.molehill.ejb.controller" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
    - <types>
    <schema targetNamespace="java:com.mountain.molehill.ejb.controller" xmlns="http://www.w3.org/1999/XMLSchema" />
    </types>
    - <message name="getPointBalanceRequest">
    <part name="arg0" type="xsd:string" />
    </message>
    - <message name="getPointBalanceResponse">
    <part name="return" type="xsd:string" />
    </message>
    - <portType name="WSManagerPortType">
    - <operation name="getPointBalance">
    <input message="tns:getPointBalanceRequest" />
    <output message="tns:getPointBalanceResponse" />
    </operation>
    </portType>
    - <binding name="WSManagerBinding" type="tns:WSManagerPortType">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    - <operation name="getPointBalance">
    <soap:operation soapAction="urn:getPointBalance" />
    - <input>
    <soap:body use="encoded" namespace="urn:WSManager" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </input>
    - <output>
    <soap:body use="encoded" namespace="urn:WSManager" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
    </output>
    </operation>
    </binding>
    - <service name="WSManager">
    <documentation>todo</documentation>
    - <port name="WSManagerPort" binding="tns:WSManagerBinding">
    <soap:address location="http://blrkec17805:7001/WS/rpc_URI" />
    </port>
    </service>
    </definitions>
    Could anybody help me in resolving this problem?
    Thanks in advance,
    Rajadurai

    Hello,
    edit the wsdl file and change 'http://www.w3.org/1999/XMLSchema' to 'http://www.w3.org/2001/XMLSchema' for both xmlns:xsd and xmlns then try again.
    Andre

Maybe you are looking for

  • Slow startup and password issue.

    Hi all... Happy new year...! As a little christmas present for myself I purchased a Crucial M4 256GB SSD for my MacPro 4,1 (2.26GHz, 22GB RAM, 10.8.2). I'm a semi-pro photographer and wanted a bit of a speed up for my processing etc etc. So yesterday

  • Startx from tmux

    Hello! I'd like to start a tmux session on every login, so I put what the wiki suggests in my .zshrc and it works as aspected. But everytime I try to startx as normal user from there, Xorg fails with this output: Fatal server error: (EE) xf86OpenCons

  • Control Chart in Crystal Report

    Hi Is it possible to create control chart in crystal report XI (with upper level and lower level limit) if it possible, can you please let me know how to do? Thanks

  • RAR: Alerts tables understanding

    Hi, After running alert generation role specifying just critical actions flag and a specific risk that includes a few transactions we have identified that the following tables are containing data: VIRSA_CC_ALLASTRUN: Dates and time when alert generat

  • Add photos together

    I cannot remember the term but I have used Photoelements 2 and 3.  I am currently using 8 and cannot find how to put two images together.  Any help will be appreciated.