How to return a web service response as XML

Sorry if this is stupid question, but I wrote a web service that returns a string (which is really XML). I was wondering if there is a better way to do this. I would like to return it as an XML structure. Is there anyway I can do this?
Just looking for the correct way to do this - don't think returning strings all the time is correct.
I am using javaEE 5, axis2 (1.5), Tomcat 6.0
Thanks for the help!

osubb wrote:
I don't see any benefit from sending byte[] vrs. String.It will prevent to have unwanted XML tags embedded in the XML of the SOAP envelope, a situation that may confuse some XML parsers.
Arrays of bytes are translated into readable characters to fit the XML conventions; there's an inconvenient : it will double the size of the original string in the SOAP message. Therefore, if your XML string is very large, the solution proposed by Tolls is preferable.
osubb wrote:
The WebService will be consumed by a non Java platformIt makes no difference; arrays of bytes are supported by non Java platforms
osubb wrote:
so would sending back a POJO work? Or would it make it a little harder.There's no need of a POJO if you opt for an array of bytes
osubb wrote:
I was wondering if I should use an attachment? Any ideas??It's not possible to attach a file to a SOAP message
osubb wrote:
Thanks for the help!!!!You're welcome !
Joe

Similar Messages

  • How to use a Web Service Response

    In the snps_users documentation it seems to be really easy but in fact...
    After invoking my web service I retrieve a XML file which is my response then we would like to use it.
    As written in the documentation I Export Response in XSD file, I create my XML Model but How to reverse the XSD ???
    There's 4 references to XSD into all the snps_users documentation but no one talking about.
    Moreover it's written See Creating and Reverse-Engineering a
    Model for an XML file for more information and that's what I'm doing but no way...
    So without the XSD I m trying to use the Response file like an XML file but I always have an error which looks like :
    java.sql.SQLException: No root found in the DTD file
    The Web Service Response XML File use NameSpace could the problem come from here ???
    If someone ever use it ...
    Thanks in advance.
    BM

    When I specify the XSD It raises another error,
    my URL is :
    jdbc:snps:xml?f=C:/Temp/File.xml&d=C:/Temp/File.xsd&s=REPON&nspg=xml
    Error message:
    java.sql.SQLException: A SAXException was caught while reading the model saying [Element value has no type]
    The XSD and the XML are generated by ODI after invoking a Web Service...
    Any idea ???

  • Potential Memory Leak during Marshelling of a Web Service Response

    I believe I have found a memory leak when using the configuration below.
    The memory leak occurs when calling a web service. When the web service function is marshelling the response of the function call, an "500 Internal Server Error ... java.lang.OutOfMemoryError" is returned from OC4J. This error may be seen via the TCP Packet Monitor in JDeveloper.
    Unfortunately no exception dump is outputted to the OC4J log.
    Configuration:
    Windows 2000 with 1 gig ram
    JDeveloper 9.0.5.2 with JAX/RPC extension installed
    OC4J 10.0.3
    Sun JVM version 1.4.2_03-b02
    To demonstrate the error I created a simple web service and client. See below the client and web service function that demonstrates it.
    The web service is made up of a single function called "queryTestOutput".
    It returns an object of class "TestOutputQueryResult" which contains an int and an array.
    The function call accepts a one int input parameter which is used to vary the size of array in the returned object.
    For small int (less than 100). Web service function returns successfully.
    For larger int and depending on the size of memory configuration when OC4J is launched,
    the OutOfMemoryError is returned.
    The package "ws_issue.service" contains the web service.
    I used the Generate JAX-RPC proxy to build the client (found in package "ws_issue.client"). Package "types" was
    also created by Generate JAX-RPC proxy.
    To test the web service call execute the class runClient. Vary the int "atestValue" until error is returned.
    I have tried this with all three encodings: RPC/Encoded, RPC/Literal, Document/Literal. They have the
    same issue.
    The OutOfMemory Error is raised fairly consistently using the java settings -Xms386m -Xmx386m for OC4J when 750 is specified for the input parameter.
    I also noticed that when 600 is specified, the client seems to hang. According to the TCP Packet Monitor,
    the response is returned. But, the client seems unable to unmarshal the message.
    ** file runClient.java
    // -- this client is using Document/Literal
    package ws_issue.client;
    public class runClient
    public runClient()
    * @param args
    * Test out the web service
    * Play with the atestValue variable to until exception
    public static void main(String[] args)
    //runClient runClient = new runClient();
    long startTime;
    int atestValue = 1;
    atestValue = 2;
    //atestValue = 105; // last one to work with default memory settings in oc4j
    //atestValue = 106; // out of memory error as seen in TCP Packet Monitor
    // fails with default memory settings in oc4j
    //atestValue = 600; // hangs client (TCP Packet Monitor shows response)
    // when oc4j memory sessions are -Xms386m -Xmx386m
    atestValue = 750; // out of memory error as seen in TCP Packet Monitor
    // when oc4j memory sessions are -Xms386m -Xmx386m
    try
    startTime = System.currentTimeMillis();
    Ws_issueInterface ws = (Ws_issueInterface) (new Ws_issue_Impl().getWs_issueInterfacePort());
    System.out.println("Time to obtain port: " + (System.currentTimeMillis() - startTime) );
    // call the web service function
    startTime = System.currentTimeMillis();
    types.QueryTestOutputResponse qr = ws.queryTestOutput(new types.QueryTestOutput(atestValue));
    System.out.println("Time to call queryTestOutput: " + (System.currentTimeMillis() - startTime) );
    startTime = System.currentTimeMillis();
    types.TestOutputQueryResult r = qr.getResult();
    System.out.println("Time to call getresult: " + (System.currentTimeMillis() - startTime) );
    System.out.println("records returned: " + r.getRecordsReturned());
    for (int i = 0; i<atestValue; i++)
    types.TestOutput t = r.getTestOutputResults();
    System.out.println(t.getTestGroup() + ", " + t.getUnitNumber());
    catch (Exception e)
    e.printStackTrace();
    ** file wsmain.java
    package ws_issue.service;
    import java.rmi.RemoteException;
    import javax.xml.rpc.ServiceException;
    import javax.xml.rpc.server.ServiceLifecycle;
    public class wsmain implements ServiceLifecycle, ws_issueInterface
    public wsmain()
    public void init (Object p0) throws ServiceException
    public void destroy ()
    System.out.println("inside ws destroy");
    * create an element of the array with some hardcoded values
    private TestOutput createTestOutput(int cnt)
    TestOutput t = new TestOutput();
    t.setComments("here are some comments");
    t.setConfigRevisionNo("1");
    t.setItemNumber("123123123");
    t.setItemRevision("arev" + cnt);
    t.setTestGroup(cnt);
    t.setTestedItemNumber("123123123");
    t.setTestedItemRevision("arev" + cnt);
    t.setTestResult("testResult");
    t.setSoftwareVersion("version");
    t.setTestConditions("conditions");
    t.setStageName("world's a stage");
    t.setTestMode("Test");
    t.setTestName("test name");
    t.setUnitNumber("UnitNumber"+cnt);
    return t;
    * Web service function that is called
    * Create recCnt number of "records" to be returned
    public TestOutputQueryResult queryTestOutput (int recCnt) throws java.rmi.RemoteException
    System.out.println("Inside web service function queryTestOutput");
    TestOutputQueryResult r = new TestOutputQueryResult();
    TestOutput TOArray[] = new TestOutput[recCnt];
    for (int i = 0; i< recCnt; i++)
    TOArray[i] = createTestOutput(i);
    r.setRecordsReturned(recCnt);
    r.setTestOutputResults(TOArray);
    System.out.println("End of web service function call");
    return r;
    * @param args
    public static void main(String[] args)
    wsmain wsmain = new wsmain();
    int aval = 5;
    try
    TestOutputQueryResult r = wsmain.queryTestOutput(aval);
    for (int i = 0; i<aval; i++)
    TestOutput t = r.getTestOutputResults()[i];
    System.out.println(t.getTestGroup() + ", " + t.getUnitNumber());
    catch (Exception e)
    e.printStackTrace();
    ** file ws_issueInterface.java
    package ws_issue.service;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface ws_issueInterface extends java.rmi.Remote
    public TestOutputQueryResult queryTestOutput (int recCnt) throws java.rmi.RemoteException;
    ** file TestOutputQueryResult.java
    package ws_issue.service;
    public class TestOutputQueryResult
    private long recordsReturned;
    private TestOutput[] testOutputResults;
    public TestOutputQueryResult()
    public long getRecordsReturned()
    return recordsReturned;
    public void setRecordsReturned(long recordsReturned)
    this.recordsReturned = recordsReturned;
    public TestOutput[] getTestOutputResults()
    return testOutputResults;
    public void setTestOutputResults(TestOutput[] testOutputResults)
    this.testOutputResults = testOutputResults;
    ** file TestOutput.java
    package ws_issue.service;
    public class TestOutput
    private String itemNumber;
    private String itemRevision;
    private String configRevisionNo;
    private String testName;
    private String testConditions;
    private String stageName;
    private String testedItemNumber;
    private String testedItemRevision;
    private String unitNumber;
    private String testStation;
    private String testResult;
    private String softwareVersion;
    private String operatorID;
    private String testDate; // to be datetime
    private String comments;
    private int testGroup;
    private String testMode;
    public TestOutput()
    public String getComments()
    return comments;
    public void setComments(String comments)
    this.comments = comments;
    public String getConfigRevisionNo()
    return configRevisionNo;
    public void setConfigRevisionNo(String configRevisionNo)
    this.configRevisionNo = configRevisionNo;
    public String getItemNumber()
    return itemNumber;
    public void setItemNumber(String itemNumber)
    this.itemNumber = itemNumber;
    public String getItemRevision()
    return itemRevision;
    public void setItemRevision(String itemRevision)
    this.itemRevision = itemRevision;
    public String getOperatorID()
    return operatorID;
    public void setOperatorID(String operatorID)
    this.operatorID = operatorID;
    public String getSoftwareVersion()
    return softwareVersion;
    public void setSoftwareVersion(String softwareVersion)
    this.softwareVersion = softwareVersion;
    public String getStageName()
    return stageName;
    public void setStageName(String stageName)
    this.stageName = stageName;
    public String getTestConditions()
    return testConditions;
    public void setTestConditions(String testConditions)
    this.testConditions = testConditions;
    public String getTestDate()
    return testDate;
    public void setTestDate(String testDate)
    this.testDate = testDate;
    public String getTestName()
    return testName;
    public void setTestName(String testName)
    this.testName = testName;
    public String getTestResult()
    return testResult;
    public void setTestResult(String testResult)
    this.testResult = testResult;
    public String getTestStation()
    return testStation;
    public void setTestStation(String testStation)
    this.testStation = testStation;
    public String getTestedItemNumber()
    return testedItemNumber;
    public void setTestedItemNumber(String testedItemNumber)
    this.testedItemNumber = testedItemNumber;
    public String getTestedItemRevision()
    return testedItemRevision;
    public void setTestedItemRevision(String testedItemRevision)
    this.testedItemRevision = testedItemRevision;
    public String getUnitNumber()
    return unitNumber;
    public void setUnitNumber(String unitNumber)
    this.unitNumber = unitNumber;
    public int getTestGroup()
    return testGroup;
    public void setTestGroup(int testGroup)
    this.testGroup = testGroup;
    public String getTestMode()
    return testMode;
    public void setTestMode(String testMode)
    this.testMode = testMode;

    I use web services a lot and I sympathize with your issue. I
    struggle with similar issues and I found this great utility that
    will help you confirm if your webservice is returning the data
    correctly to Flex. I know you said it works in other applications
    but who knows if flex is calling it correctly etc. This utility is
    been the most amazing tool in helping me resolve web service
    issues.
    http://www.charlesproxy.com/
    Once you can confirm the data being returned is good you can
    try several things in flex. Try changing your result format to
    object or e4x etc. See how that plays out. Not sure where your
    tapping in to look at your debugger, you might want to catch it
    right at the result handler before converting to any collections. .
    If nothing here helps maybe post some code to look at. .
    .

  • Set listbox items from web service response

    Hi All
    I am trying to set list box items from a web service response. Couple of issues over here:
    1. The user should be able to select multiple items from the list. Hence if I set "Allow multiple values" and set Commit on "exit", then after the web service returns the output, no data is displayed in the listbox. I need to click inside the list box to see the data returned by the web service. How to overcome this..??  ( However this problem (clicking inside the listbox to see the items) does not exist if "Allow multiple values" is unchecked and Commit is set on "Select". )
    2. After the list box is filled up, certain default values should be selected. This selection is based on one of the response field (which is actually a table with multiple values... ). Hence, how to capture this response field and set the default values in the above list..??
    3. The same case for a dropdown. The values are visible in dropdown. However, a default value should be selected and displayed after returning a response from web service. Again, this default value is dependant on another field in the response as in point no.2
    I am trying to use postExecute event as described in [this|http://forms.stefcameron.com/2009/03/23/pre-process-web-service-responses/] link...however not able to achieve the functionality. Please provide suggestions / inputs.
    Thanks
    Deepak

    Hello,
    first: I don´t know anything about the right solution. I am unaware of the existence of the solution, because there were quite many of question about this multiple selection problem and I don´t remember a single "answer".
    I can recommend you to simplify everything and create the functionality yourself. I have done that before to avoid these "Adobe-standard" problems. If you have a problem with autofill of the object, ask your WS to send you a single string and pass it yourself using scripting (JS).
    And if you have problems with multiple selection, create your own field/ object. Get the string of values, parse it, create multiple lines of the dynamic table with some suitable tool to check/ select the rows you need (use checkbox for example, and your text as a table row). This way you can selected anything you want with no problems at all. It wil only cost you some extra work.
    Regards, Otto

  • Retrieve error message of SAP provided web service in web service response

    Hi All,
    We have a SAP provided web service that sometimes fails to process data it is called with. This is not a problem as the data sometimes is just plain wrong (i.e. date field contains text). However, the error is only logged in SAP and can only be queried using SRT_UTIL.
    The problem is that the error is not reported back via the response. How can we set up the web service so that the error could be displayed by the calling party without logging into SAP?
    Thanks for the help in advance.
    Best Regards,
    Daniel

    Hi Calvin,
    The WS is indeed synchronous. The problem is not whether the error is captured or not. It is captured indeed but it is logged inside SAP only and not returned via the Web Service response mechanism. The error message says that error message can be retrieved using SRT_UTIL.
    This is a major problem as the users of the outside system calling SAP have no right to use SRT_UTIL to track down the error. They need to contact SAP basis in order to get to the end of it.
    What we need to achieve is to get back the same error message that can be seen with SRT_UTIL via the web service.
    Thanks.

  • How to call a web Service from Oracle Applications?

    Hi friends,
    I've posted this question on OA Framework forum , but may be it's more appropiated put it here. Sorry for do it again:
    It's about how to call a web service from a Form or a .sql (via Request) in Oracle Applications:
    Could you please explain here the detailed steps (with code example if it's possible) to invoke a webservice from Oracle Applications?.. how did yo do it...?
    I've read differents posts here and the 33097.1 metalink note (by the way, the first recommended link in this note is broken...), but there are lots of theorical concepts and no real examples to see how/from where invoke the WS
    I'll have to call one webservice (I suppose the customer will give me the interface implementation)...but I've never did it with Applications so that's why I ask you for all the detailed steps...
    I work with Forms 6i, Apps 11.5.10.2 and DB 9.2.0.7.
    Thanks a lot.
    Jose.

    Hello Jose,
    I did using java program to call BPEL web services in 11.5.10.
    I pasted below the metalink note for your reference (Note:250964.1)
    The idea is first write a java program to call the webservice (in my case it is calling an BPEL web service, so this may not help directly), test it.
    Then port the java program as specified in the note, so that you could call your web service through concurrent manager scheduler.
    Is this ok?
    Thanks
    Arun.
    ======================================================
    Checked for relevance on 25-Apr-2007
    Application Install - Version: 11.5.8 to 11.5.10
    Goal
    ====
    How to register and create a Java concurrent program for Oracle Applications
    Release 11i
    Solution
    ========
    1. Create your Java Concurrent Program (JCP) , using a text editor.
    /*===========================================================================+
    | Concurrent Processing Sample Code |
    | |
    | FILENAME |
    | Hello.java |
    | |
    | DESCRIPTION |
    | Sample Java concurrent program |
    | About the simplest possible program, just writes a message to the |
    | logfile and output file. |
    | |
    | HISTORY |
    | $Log$ |
    | |
    +===========================================================================*/
    package oracle.apps.fnd.cp.sample;
    import oracle.apps.fnd.cp.request.*;
    public class Hello implements JavaConcurrentProgram {
    public static final String RCS_ID = "$Header$";
    public void runProgram(CpContext ctx) {
    ctx.getLogFile().writeln("-- Hello World! --", 0);
    ctx.getOutFile().writeln("-- Hello World! --");
    ctx.getReqCompletion().setCompletion(ReqCompletion.NORMAL, "");
    =======================================
    End Sample
    =======================================
    2. Create a sample directory under $JAVA_TOP:
    $ mkdir $JAVA_TOPoracle/apps/fnd/cp/sample
    3. Copy Hello.java into $JAVA_TOP/oracle/apps/fnd/cp/sample:
    $ cp $HOME/Hello.java $JAVA_TOP/oracle/apps/fnd/cp/sample
    4. Compile your java program:
    javac $JAVA_TOP/oracle/apps/fnd/cp/sample/Hello.java
    5. Test at the command line with following syntax:
    jre -Ddbcfile=$FND_TOP/secure/your_dbc_file.dbc \
    -Drequest.outfile=./outfile \
    oracle.apps.fnd.cp.request.Run \
    oracle.apps.fnd.cp.sample.Hello
    6. Register your custom java concurrent program with Oracle Applications.
    a. Navigate: Concurrent > Program > Executable
    b. Enter details into the form
    Executable: JCPHELLO
    Shortname: JCPHELLO
    Application: Application Object Library
    Execution Method: Java Concurrent Program
    Execution File Name: Hello (Insert a name that does not contain space or period)
    Execution File Path: oracle.apps.fnd.cp.sample
    c. Save the details
    d. Navigate: Concurrent > Program > Define
    e. Enter details into the form
    Program Name: JCPHELLO
    Program Shortname: JCPHELLO
    Application: Application Object Library
    Executable: Choose JCPHELLO from LOV
    Executable Options :
    f. Save the details
    7. Add this new concurrent request to your responsibility request group.
    a. Navigate > Security > Responsiblity > Request
    b. Query System Administrator
    c. Add new row and choose TestJava
    d. Save the changes.
    8. Run your new Hello Java Concurrent Program
    Navigate: Request > Run
    References
    ~~~~~~~~~~~
    Oracle Applications Developers Manual for Release 11i A75545-01
    ====================================================

  • Web service response processing inside a BPM

    Hi Experts,
    Please can you let me know if it is possible to achieve the following inside a BPM:
    u2022     Once you getting the web service  SOAP response, determine if itu2019s a SOAP fault or a normal web service response.
    u2022     If itu2019s a SOAP fault, create a retry loop with a wait step inside the BPM to try and retry the process (perhaps 5 times in 1 minute intervals).
    u2022     After the retry intervals, if the message is still in a failed step, force the BPM to go into an error state
    u2022     If the Web Service returns a normal response, log the response inside a database table and end the BPM
    If it is possible, please can you provide an example?
    Thank you,
    Brendon

    Hi
    Have you found the workaround?
    Sorry for refreshing topic. Flag mustUnderstand ='1' in response is unussual thing.
    BR

  • Web service response contains SOAP Headers with "mustUnderstand" true

    Hi
    I have a requirement where in I have to consume a web service as adaptive web service model, and while executing the service pass a mandatory parameter to the soap header. We are able to set the mandatory parameter to the soad header. We got the code snippet to do this from a wiki link
    http://wiki.sdn.sap.com/wiki/display/WDJava/FAQ-Models-AdaptiveWebService#FAQ-Models-AdaptiveWebService-WhatarethefunctionalgapsofthecurrentAdpativeWSModelImporter%3F
    On executing the service now through web dynpro we are getting the below error
    "Web service response contains SOAP Headers with "mustUnderstand" true which are not handled by the client runtime"
    Any thoughts on how to handle this mustUnderstand attribute with some code snippet? Appreciate all help.
    Thanks,
    KN.

    Hi
    Have you found the workaround?
    Sorry for refreshing topic. Flag mustUnderstand ='1' in response is unussual thing.
    BR

  • Marshelling Web Service Response Memory Leak

    I believe I have found a memory leak when using the configuration below.
    The memory leak occurs when calling a web service. When the web service function is marshelling the response of the function call, an "500 Internal Server Error ... java.lang.OutOfMemoryError" is returned from OC4J. This error may be seen via the TCP Packet Monitor in JDeveloper.
    Unfortunately no exception dump is outputted to the OC4J log.
    Configuration:
    Windows 2000 with 1 gig ram
    JDeveloper 9.0.5.2 with JAX/RPC extension installed
    OC4J 10.0.3
    Sun JVM version 1.4.2_03-b02
    To demonstrate the error I created a simple web service and client. See below the client and web service function that demonstrates it.
    The web service is made up of a single function called "queryTestOutput".
    It returns an object of class "TestOutputQueryResult" which contains an int and an array.
    The function call accepts a one int input parameter which is used to vary the size of array in the returned object.
    For small int (less than 100). Web service function returns successfully.
    For larger int and depending on the size of memory configuration when OC4J is launched,
    the OutOfMemoryError is returned.
    The package "ws_issue.service" contains the web service.
    I used the Generate JAX-RPC proxy to build the client (found in package "ws_issue.client"). Package "types" was
    also created by Generate JAX-RPC proxy.
    To test the web service call execute the class runClient. Vary the int "atestValue" until error is returned.
    I have tried this with all three encodings: RPC/Encoded, RPC/Literal, Document/Literal. They have the
    same issue.
    The OutOfMemory Error is raised fairly consistently using the java settings -Xms386m -Xmx386m for OC4J when 750 is specified for the input parameter.
    I also noticed that when 600 is specified, the client seems to hang. According to the TCP Packet Monitor,
    the response is returned. But, the client seems unable to unmarshal the message.
    ** file runClient.java
    // -- this client is using Document/Literal
    package ws_issue.client;
    public class runClient
    public runClient()
    * @param args
    * Test out the web service
    * Play with the atestValue variable to until exception
    public static void main(String[] args)
    //runClient runClient = new runClient();
    long startTime;
    int atestValue = 1;
    atestValue = 2;
    //atestValue = 105; // last one to work with default memory settings in oc4j
    //atestValue = 106; // out of memory error as seen in TCP Packet Monitor
    // fails with default memory settings in oc4j
    //atestValue = 600; // hangs client (TCP Packet Monitor shows response)
    // when oc4j memory sessions are -Xms386m -Xmx386m
    atestValue = 750; // out of memory error as seen in TCP Packet Monitor
    // when oc4j memory sessions are -Xms386m -Xmx386m
    try
    startTime = System.currentTimeMillis();
    Ws_issueInterface ws = (Ws_issueInterface) (new Ws_issue_Impl().getWs_issueInterfacePort());
    System.out.println("Time to obtain port: " + (System.currentTimeMillis() - startTime) );
    // call the web service function
    startTime = System.currentTimeMillis();
    types.QueryTestOutputResponse qr = ws.queryTestOutput(new types.QueryTestOutput(atestValue));
    System.out.println("Time to call queryTestOutput: " + (System.currentTimeMillis() - startTime) );
    startTime = System.currentTimeMillis();
    types.TestOutputQueryResult r = qr.getResult();
    System.out.println("Time to call getresult: " + (System.currentTimeMillis() - startTime) );
    System.out.println("records returned: " + r.getRecordsReturned());
    for (int i = 0; i<atestValue; i++)
    types.TestOutput t = r.getTestOutputResults();
    System.out.println(t.getTestGroup() + ", " + t.getUnitNumber());
    catch (Exception e)
    e.printStackTrace();
    ** file wsmain.java
    package ws_issue.service;
    import java.rmi.RemoteException;
    import javax.xml.rpc.ServiceException;
    import javax.xml.rpc.server.ServiceLifecycle;
    public class wsmain implements ServiceLifecycle, ws_issueInterface
    public wsmain()
    public void init (Object p0) throws ServiceException
    public void destroy ()
    System.out.println("inside ws destroy");
    * create an element of the array with some hardcoded values
    private TestOutput createTestOutput(int cnt)
    TestOutput t = new TestOutput();
    t.setComments("here are some comments");
    t.setConfigRevisionNo("1");
    t.setItemNumber("123123123");
    t.setItemRevision("arev" + cnt);
    t.setTestGroup(cnt);
    t.setTestedItemNumber("123123123");
    t.setTestedItemRevision("arev" + cnt);
    t.setTestResult("testResult");
    t.setSoftwareVersion("version");
    t.setTestConditions("conditions");
    t.setStageName("world's a stage");
    t.setTestMode("Test");
    t.setTestName("test name");
    t.setUnitNumber("UnitNumber"+cnt);
    return t;
    * Web service function that is called
    * Create recCnt number of "records" to be returned
    public TestOutputQueryResult queryTestOutput (int recCnt) throws java.rmi.RemoteException
    System.out.println("Inside web service function queryTestOutput");
    TestOutputQueryResult r = new TestOutputQueryResult();
    TestOutput TOArray[] = new TestOutput[recCnt];
    for (int i = 0; i< recCnt; i++)
    TOArray = createTestOutput(i);
    r.setRecordsReturned(recCnt);
    r.setTestOutputResults(TOArray);
    System.out.println("End of web service function call");
    return r;
    * @param args
    public static void main(String[] args)
    wsmain wsmain = new wsmain();
    int aval = 5;
    try
    TestOutputQueryResult r = wsmain.queryTestOutput(aval);
    for (int i = 0; i<aval; i++)
    TestOutput t = r.getTestOutputResults();
    System.out.println(t.getTestGroup() + ", " + t.getUnitNumber());
    catch (Exception e)
    e.printStackTrace();
    ** file ws_issueInterface.java
    package ws_issue.service;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    public interface ws_issueInterface extends java.rmi.Remote
    public TestOutputQueryResult queryTestOutput (int recCnt) throws java.rmi.RemoteException;
    ** file TestOutputQueryResult.java
    package ws_issue.service;
    public class TestOutputQueryResult
    private long recordsReturned;
    private TestOutput[] testOutputResults;
    public TestOutputQueryResult()
    public long getRecordsReturned()
    return recordsReturned;
    public void setRecordsReturned(long recordsReturned)
    this.recordsReturned = recordsReturned;
    public TestOutput[] getTestOutputResults()
    return testOutputResults;
    public void setTestOutputResults(TestOutput[] testOutputResults)
    this.testOutputResults = testOutputResults;
    ** file TestOutput.java
    package ws_issue.service;
    public class TestOutput
    private String itemNumber;
    private String itemRevision;
    private String configRevisionNo;
    private String testName;
    private String testConditions;
    private String stageName;
    private String testedItemNumber;
    private String testedItemRevision;
    private String unitNumber;
    private String testStation;
    private String testResult;
    private String softwareVersion;
    private String operatorID;
    private String testDate; // to be datetime
    private String comments;
    private int testGroup;
    private String testMode;
    public TestOutput()
    public String getComments()
    return comments;
    public void setComments(String comments)
    this.comments = comments;
    public String getConfigRevisionNo()
    return configRevisionNo;
    public void setConfigRevisionNo(String configRevisionNo)
    this.configRevisionNo = configRevisionNo;
    public String getItemNumber()
    return itemNumber;
    public void setItemNumber(String itemNumber)
    this.itemNumber = itemNumber;
    public String getItemRevision()
    return itemRevision;
    public void setItemRevision(String itemRevision)
    this.itemRevision = itemRevision;
    public String getOperatorID()
    return operatorID;
    public void setOperatorID(String operatorID)
    this.operatorID = operatorID;
    public String getSoftwareVersion()
    return softwareVersion;
    public void setSoftwareVersion(String softwareVersion)
    this.softwareVersion = softwareVersion;
    public String getStageName()
    return stageName;
    public void setStageName(String stageName)
    this.stageName = stageName;
    public String getTestConditions()
    return testConditions;
    public void setTestConditions(String testConditions)
    this.testConditions = testConditions;
    public String getTestDate()
    return testDate;
    public void setTestDate(String testDate)
    this.testDate = testDate;
    public String getTestName()
    return testName;
    public void setTestName(String testName)
    this.testName = testName;
    public String getTestResult()
    return testResult;
    public void setTestResult(String testResult)
    this.testResult = testResult;
    public String getTestStation()
    return testStation;
    public void setTestStation(String testStation)
    this.testStation = testStation;
    public String getTestedItemNumber()
    return testedItemNumber;
    public void setTestedItemNumber(String testedItemNumber)
    this.testedItemNumber = testedItemNumber;
    public String getTestedItemRevision()
    return testedItemRevision;
    public void setTestedItemRevision(String testedItemRevision)
    this.testedItemRevision = testedItemRevision;
    public String getUnitNumber()
    return unitNumber;
    public void setUnitNumber(String unitNumber)
    this.unitNumber = unitNumber;
    public int getTestGroup()
    return testGroup;
    public void setTestGroup(int testGroup)
    this.testGroup = testGroup;
    public String getTestMode()
    return testMode;
    public void setTestMode(String testMode)
    this.testMode = testMode;

    Many thanks for your help.  This solved the issue for our .NET code, however the leak is still present in the report designer.  I was also wondering if you could help further: because of the limits on the java memory process is there a way to ensure that a separate java process is started for each report that is loaded in my report viewers collection?  Essentially the desktop application that i have created uses a tab control to display each type report, so each tab goes through the following code when displaying a report and closing a tab:
    Is there a way to ensure that a different Java process is kicked off each time that I display a different report?  My current code in c# always uses the same Java process so the memory ramps up.  The code to load the report and then dispose of the report through closing the tab (and now the Java process) looks like this:
        private void LoadCrystalReport(string FullReportName)
          ReportDocument reportDoc = new ReportDocument();
          reportDoc.Load(FullReportName, OpenReportMethod.OpenReportByTempCopy);
          this.crystalReportViewer1.ReportSource = reportDoc;
        private void DisposeCrystalReportObject()
          if (crystalReportViewer1.ReportSource != null)
            ReportDocument report = (ReportDocument)crystalReportViewer1.ReportSource;
            foreach (Table table in report.Database.Tables)
              table.Dispose();
            report.Database.Dispose();
            report.Close();
            report.Dispose();
            GC.Collect();
    Thanks

  • How to test swaref web service method

    My simple web service method:
         @WebMethod
         @XmlAttachmentRef
         public DataHandler getFile() {
              FileDataSource file = new FileDataSource("c:\\1.gif");
              DataHandler handler = new DataHandler(file);
              return handler;
    the generated wsdl codes:
    *<xs:complexType name="getFileResponse">*
    *<xs:sequence>*
    *<xs:element minOccurs="0" name="file" type="swaRef:swaRef" />*
    *</xs:sequence>*
    *</xs:complexType>*
    I always use Eclipse web service explorer to test web service, but it doesn't support swaref web service method.
    Then I use axis WSDL2JAVA to generate web service client, but the generated "getFile" return type is not "DataHandler", but "org.apache.axis.types.URI".
    How to test swaref web service method?
    Thanks
    Edited by: tomsonxu on Jan 8, 2008 7:40 AM
    Edited by: tomsonxu on Jan 8, 2008 7:41 AM

    Hello..
    How did u develop the webservice?
    I mean did u develop the Webservice using Enter prise Java Bean....
    Wrap EJB in ear and deploy to the Server and now u can test the EJB method
    whether it is working fine or not
    Try these -
    http://help.sap.com/saphelp_nw04s/helpdata/de/f7/af60f2e04d0848888675a800623a81/frameset.htm
    Inorder to use the webservice in the Webdynpro, normally we will use the WSDL of webservice
    and Import  the model using any one of them
    After importing as model we can use the EJB methods!
    Try it !!
    Thanks
    Shravan

  • How to consume/access web services in forefront identity manager 2010 r2

    Hi,
    I have one web service  in c# for authentication  so i want to integrate this web service in my FIM 2010 R2.I want to ask one more question how to consume/access web service of FIM 2010 R2,so please tell me how is it possible in FIM 2010 R2 and
    anybody have any example for consuming/accessing web service step by step in FIM 2010 R2.
    Regards
    Anil Kumar

    Here is some C# code that accesses FIM resource attributes from the web services via the FIM 2010 Resource Management Client which I mentioned in an earlier post:
    using System;
    using System.Collections.Generic;
    using Microsoft.ResourceManagement.Client;
    using Microsoft.ResourceManagement.ObjectModel;
    namespace MyTest
    public partial class ResourceAttribute
    public ResourceAttribute()
    public string GetTypeAndDisplayName(string objectID)
    String ReturnValue = String.Empty;
    using (Microsoft.ResourceManagement.Client.DefaultClient client = new DefaultClient())
    client.ClientCredential = CredentialCache.DefaultNetworkCredentials;
    client.RefreshSchema();
    string query = String.Format("/*[ObjectId={0}]", objectID);
    foreach (RmResource res in client.Enumerate(query))
    String displayName = res.DisplayName;
    String objectType = res.ObjectType;
    ReturnValue = displayName + " (" + objectType + ")";
    break;
    return ReturnValue;
    You would just need to define your bindings and endpoints in your web.config. This method will return the DisplayName and ObjectType for the resource with the ObjectId matching the objectID argument. If you need more information, please provide more specifics
    for what you are trying to accomplish.
    There are many code examples for this library on its CodePlex home:
    http://fim2010client.codeplex.com/

  • 11G - XDB Native Web Services - how to create a web service proxy

    Hi,
    I am working on XDB Native web Services (http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/xdb_web_services.htm#CHDDBCHB). I want to create a proxy web service for orawsv service (http://server:port/orawsv?wsdl), which is protected by an user/password
    In Jdeveloper 10133:
    + copy orawsv wsdl (http://server:port/orawsv?wsdl) in local file
    + create a proxy web service form the local wsdl (from the wizard)
    + implement the client (http://www.oracle.com/technology/obe/11gr1_db/datamgmt/xmldb2_b/xmldb2_b.htm)
    ==> OK
    In Jdeveloper 11g
    + copy orawsv wsdl (http://server:port/orawsv?wsdl) in local file
    + create a proxy web service form the local wsdl (from the wizard)
    + how to implement the client : there is no method to set a password
    any ideas?
    Thanks for your help,
    Cyryl
    Edited by: cbalmati on Oct 21, 2008 6:26 AM

    I'm working on getting a proxy web service working in 11g and the contents of this thread is close to answering my question.
    The web service proxy is accessing a service that requires a SOAP Security header.
    In looking at the previous post, I thought that by using the BindingProvider API I could add the security settings. But when I invoke the proxy I consistently get the following error response from the (PeopleSoft) web service: "com.sun.xml.ws.client.ClientTransportException: request requires HTTP authentication: Unauthorized'
    In contrast to that error, when I use JDeveloper's HTTP Analyzer, I get a successful response from the web service. Below is what the raw HTTP looks like:
    POST https://isiswebdev.services.wisc.edu:7002/PSIGW/PeopleSoftServiceListeningConnector HTTP/1.1
    Content-Type: text/xml; charset=UTF-8
    Host: isiswebdev.services.wisc.edu:7002
    SOAPAction: "CI_U_FA_CSA_STDTA_CI_G.V2"
    Content-Length: 548
    X-HTTPAnalyzer-Rules: 1
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns2="http://xmlns.oracle.com/Enterprise/Tools/schemas/M183895.V1">
    <env:Header>
    <ns1:Security>
    <ns1:UsernameToken>
    <ns1:Username>UserName</ns1:Username>
    <ns1:Password>XXXXXXX</ns1:Password>
    </ns1:UsernameToken>
    </ns1:Security>
    </env:Header>
    <env:Body>
    <ns2:Get__CompIntfc__U_FA_CSA_STDTA_CI>
    <ns2:EMPLID>012345678912</ns2:EMPLID>
    </ns2:Get__CompIntfc__U_FA_CSA_STDTA_CI>
    </env:Body>
    </env:Envelope>
    Here's the Java code that I'm using to try to make the same call:
    public void callIWebservice(String emplId){
    cSA_STDNT_DATA = new CSA_STDNT_DATA();
    CI_U_FA_CSA_STDTA_CI_PortType port = cSA_STDNT_DATA.getCI_U_FA_CSA_STDTA_CI_Port();
    Map<String, Object> requestContext = ((BindingProvider)port).getRequestContext();
    requestContext.put(BindingProvider.USERNAME_PROPERTY, "UserName");
    requestContext.put(BindingProvider.PASSWORD_PROPERTY,"XXXXXXX");
    GetCompIntfcUFACSASTDTACITypeShape CiType = new GetCompIntfcUFACSASTDTACITypeShape();
    EMPLIDTypeShape emplIDType = new EMPLIDTypeShape();
    emplIDType.setValue(emplId);
    CiType.setEMPLID(emplIDType);
    try {
    GetCompIntfcUFACSASTDTACIResponseTypeShape response = port.getDATA(CiType);
    System.out.println(response.getCUMGPA());
    } catch (M464939V1 e) {
    System.out.println(e.getFaultInfo());
    But, alas, I just get the ClientTransportException.
    Is the Bindingprovider interface the correct way to add the soap security headers? Or am I following the wrong path?
    Any help will be greatly appreciated.

  • How to consume a web service provided by third party system from SAP system

    Hi Friends,
    Could any of you provide me a clear picture on how to consume a web service from SAP system and is provided by a third party system?
    Do we get an URL to create a client proxy for consuming the web service?
    Thanx in advance,
    Ram

    Hi Ram,
    of course you cannot supply the WSDL URL. Inside the WSDL (just view it in your browser) you find (usually but not necessary) towards the end something like
    <soap:address location="http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php"/>
    which is the actual adress of the service.
    An example service can be found here:
    <a href="http://www.weather.gov/xml/">National Digital Forecast Database</a>
    containing the WSDL URL at
    <a href="http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl">this address</a>.
    You might also want to browse for the amazon webservices which allow you to embed queries against amazon into your application.
    have fun,
    anton

  • How to access .asmx Web Service using JAVA? Newbie

    Hello Experts,
    Currently, I have a project where in I have to access a ,NET web service. It is made of C#. I just want to ask how will I start the accessing process? I made this simple equation on how my project is.
    Java Project + C#.Net Web Service = Integration
    1. Do i need to create a Web Service too for the Java Project? If yes, What are the necessary tools needed for the creation of this Java Web Service?
    2. The .NET Web Service is available online. (It is made by other people).
    3. Based on the equation, what is the equivalent technology for the + sign?
    4. Can you site a concrete example for accessing a web service?
    5. I'm new here. Totally I have no idea where to start.
    6. Thank you experts.
    Edited by: Benedict.Aluan on 05 30, 08 1:38 PM
    Edited by: Benedict.Aluan on 05 30, 08 1:39 PM

    Hello
    Thanks a lot for your help ...
    I am developing simple J2EE based web service client using IBM WSAD 5.1. I have used the following code to call .asmx web service in Java
    String url = "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl";
         String namespace = "http://tempuri.org/";
         name = request.getParameter("txtName");
         try
              System.out.println("In Internet Service");
              ServiceFactory factory = ServiceFactory.newInstance();
              Service serv = factory.createService(new URL(url),new QName(namespace,"TempConvert"));
              System.out.println("Got Service......");
              Call obj = (Call)serv.createCall();
              System.out.println("Got Call......");
              obj.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,"");
              obj.setProperty(Call.OPERATION_STYLE_PROPERTY,"wrapped");
              obj.setTargetEndpointAddress(url);
              obj.setPortTypeName(new QName(namespace,"TempConvertSoap"));
              obj.setOperationName(new QName(namespace,"FahrenheitToCelsius"));
              obj.addParameter("param1",XMLType.XSD_STRING,String.class,ParameterMode.IN);
              obj.setReturnType(XMLType.XSD_STRING);
              System.out.println("Parameters Set.....");
              Object[] params = new Object[]{name};
              k = (String)obj.invoke(params);
              System.out.println("Result: "+k);
         catch(Exception e)
            System.out.println("Exception is : "+e);
        }But this code is throwing exception that
    Invalid Address "http://www.w3schools.com/webservices/tempconvert.asmx?wsdl"I have also tried this URL with Java Proxy. But it showing the same error.
    Plz can u tell me how to access .asmx web service ?
    Waiting 4 reply.

  • How to access/invoke Web Service from BPM Process

    The following steps required to attach and invoke web service method from process:
    1) Add a module in the catalog for ex WebServiceMO
    2) Add WebService Catalog component demoWebService in WebServiceMO
    3) Put ur WSDL address in WSDL address field like "http://localhost:8080/test/test?wsdl"
    4) Click next to introspect the web service it will import required files and setting from the url to your project
    5) Now for invoking webservice just call the method for ex.
    @return as String[]
    getTestStringList(TestInterfaceService, out @return : @return)
    logMessage "web service calll result >>"+length(@return)+">>>"+@return[0]
    Here @ return is the return from webservice call.
    this way u can access web service from BPM process.
    Edited by: Anurag Yadav on Jul 17, 2009 2:19 PM

    I have a web service which does not return any value but when I introspect the web service, I have an out parameter to it.. Not sure why?
    For e.g.
    TestServiceListener.addTestNotes(TestNotes : testNotes, out TestNoteResponse : testNoteResponse);
    So here I see an out parameter, but my web-service has no out parameter...
    Any idea why is this happening?

Maybe you are looking for