JAX-WS: How to get SoapMessage that contains SoapFault ?

Hello all
I am using JAX-WS to invoke a web service. (Say for example: [http://weblogs.java.net/blog/jitu/archive/2006/01/accessing_googl_1.html] )
Now, if I get a SOAPFault ( means when WebServiceException gets thrown) I want to print the corresponding SoapMessage.
E.g. I want to print something like
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Server was unable to process request.</faultstring>
<detail>
<error>
<code>0x80041102</code>
<description>The specified entity was not found.</description>
<type>Platform</type>
</error>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Can someone please help me out in this regards?
Thanks in advance.
~pp

sample code to invoke above method
private String callWS(WSServiceConfig serviceConfig, String soapRequest)
         throws SOAPException, IOException
     try
         String wsdl = serviceConfig.getUrl();
         URL url = new URL(wsdl);
         QName serviceName = new QName(serviceConfig.getNamespaceUri(),
              serviceConfig.getServiceName());
         QName portName = new QName(serviceConfig.getNamespaceUri(),
              serviceConfig.getPortName());
         Service service = Service.create(url, serviceName);
         Dispatch dispatch = service.createDispatch(portName,
              SOAPMessage.class, Service.Mode.MESSAGE);
         if (serviceConfig.getSoapActionUri() != null)
          dispatch.getRequestContext().put(
               Dispatch.SOAPACTION_URI_PROPERTY,
               serviceConfig.getSoapActionUri().trim());
         MessageFactory mf = MessageFactory.newInstance();
         SOAPMessage req = mf.createMessage(null, IOUtil
              .getBufferedInputStream(soapRequest.getBytes()));
         SOAPMessage res = (SOAPMessage) dispatch.invoke(req);
         ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
         res.writeTo(byteArrayOutputStream);
         return IOUtil.getString(byteArrayOutputStream);
     catch (WebServiceException we)
         logger.error("failed to invoke ws -- " + we.getMessage(), we);
         if (we instanceof SOAPFaultException)
          // return soap fault
          return returnSoapFault((SOAPFaultException) we);
         throw we;
    }

Similar Messages

  • E4X : How to get elements that contain a string pattern in the node name?

    Is there a way to extract children from an XMLList where the node name of a child contains a string pattern?
    For example :
    <record>
         <XblahX/>
         <cow/>
         <YblahY/>
    </record>
    How to get the elements of record that have a node name that contains the string "blah"?

    var rec:XML = <record>
         <XblahX/>
         <cow/>
         <YblahY/>
    </record>;
    var r:RegExp = /blah/;
    var elems:XMLList = rec.children().(localName().search(r)>-1);
    trace(elems.toXMLString())

  • I am trying to set up my apple tv on a sony KDL - 40xbr4. The remote is a sony RM-V302. I plugged it into the HDMI IN on the side of the TV but cannot find out how to get to that input. I am at a winter rental property and brought my Apple TV with me.

    I am trying to set up my apple tv on a sony KDL - 40xbr4. The remote is a sony RM-V302. I plugged it into the HDMI IN on the side of the TV but cannot find out how to get to that input. I am at a winter rental property and brought my Apple TV with me. I did check internet for solutions. The instructions I found said to use a "home button" on the remote.  There isn't one. I sure would appreciate help if someone knows a solution.  My first post - hope I did this right.

    if its anything like my Sony, theres a button top left corner that upon each press i get an audible bleep and the AV inputs come up on screen, i then cycle down to whichever input i wish to select!
    in case your remote is different, the button on my remote has a square with a slightly smaller square just overlapping the first square.
    hope that helps?
    rgds Lee.

  • So, I made my account a while ago before I had an iPhone so I can get music. The result of that I can't remember my security questions, and it tells me to send a rescue email an alert, but it doesn't show you how to get to that page. Can someone help me?

    So, I made my account a while ago before I had an iPhone so I can get music. The result of that I can't remember my security questions, and it tells me to send a rescue email an alert, but it doesn't show you how to get to that page. I am getting quite annoyed because apples hours arent the best fitted to my scedule since I have school and work, so I cant call and ask how to get fixed. Please help me all I want to do is buy some music...

    Click here and fill out the form.
    (90729)

  • I disabled my iPhone 4 and while doing a restore via iTunes,  it is downloading and timing out so the download is not completing. any idea how to get past that?  I have tried many times and the same error keeps happening.

    I disabled my iPhone 4 and while doing a restore via iTunes,  it is downloading and timing out so the download is not completing. any idea how to get past that?  I have tried many times and the same error keeps happening.

    You need to force the phone into recovery mode, as described here, & restore it:
    http://support.apple.com/kb/ht1808
    Sorry, you've already lost all data on your phone.

  • How to get alert that Tenant's VM is up?

    hi guys... how to get alert that tenant vm is up?

    Hi Weili,
    >>it will call the script function to run the measuring vm usage.
    Could you please detail "measuring vm usage" ?
    I mean which usage will be measured .
    Best Regards
    Elton Ji
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Get line that contains and then get the second and fourth line after that.

    So I have a text file and I want it to find all the lines in the file that contain an @ symbol and then I want it to get that line and the line second and fourth from that line. Then I would export it like this:
    $linewith@ + ":" + $secondline + ":" + $fourthline
    Finding the lines with an @ symbol is easy, but how would I tell it to get the second and fourth line after the line with an @ symbol?
    So I would get the lines with something like this:
    foreach ($line in [System.IO.File]::ReadLines($filename)) {
    if($line.contains("@")){}

    That worked perfectly thanks man! Here is the entire code. I'm sure it could been cleaned up. I'm still learning powershell. 
    $username = "Username"
    $password = "Password"
    $url = "http://URL"
    $ie = New-Object -com InternetExplorer.Application
    $ie.visible=$false
    $ie.navigate($url)
    while($ie.ReadyState -ne 4) {start-sleep -m 100}
    $ie.document.getElementById("username").value = "$username"
    $ie.document.getElementById("password").value = "$password"
    $ie.document.getElementById("click").click()
    start-sleep 20
    $ie.Document.body.innertext | Out-File -FilePath c:\web.txt
    $links = $ie.Document.getElementsByTagName('A')
    $logout = $links | where {$_.innerText -eq 'logout'}
    $logout.click()
    start-sleep 5
    (gc C:\web.txt) | ? {$_.trim() -ne ""} | set-content C:\web.txt
    ( Get-Content C:\web.txt | Select-Object -Skip 2 | ForEach-Object { $_.TrimStart( " " ) } ) | Set-Content C:\web.txt
    start-sleep 5
    $fileContents = Get-Content C:\web.txt
    foreach ($line in $fileContents) {
    if ($line -like '*@*') {
    $line + ":" + $($fileContents[$line.ReadCount+0]) + ":" + $($fileContents[$line.ReadCount+3]) | Out-File -FilePath c:\finish.txt -Append

  • HT4557 I have my main computer (desktop) and my laptop and my Iphone all set up under the same itunes account.  I cannot figure out how to get music that I purchased on my iphone to my desktop or laptop! I have homesharing on!  It's very frustrating!

    I have home share turned on and have a desktop for the main acct and a laptop and an I-phone.  I purchased music on my Iphone and can't figure out how to get it onto move the desktop or laptop.  It's very frustrating because I don't understand some of the I-tunes terminology and I have read through it all and did what sounds right but still no success!!  Grrrrr.....I feel like I need someone to walk me through it!

    Open itunes, connect iphone, click File>Devices>Transfer Purchases

  • How to get alert that a vm is up?

    hi guys, how to get alert when tenant vm is getting up?

    You need SCOM for monitoring and alerting - not ConfigMgr.
    Gerry Hampson | Blog:
    www.gerryhampsoncm.blogspot.ie | LinkedIn:
    Gerry Hampson | Twitter:
    @gerryhampson

  • Any news on how to get back that $100 promised to us

    Anticipating my refund...does anyone know how to get our 100 dollar store credit?

    There has been no process put in place regarding the rebate. It is only Tuesday and Steve J did say this week, no specific date.
    mikeab

  • PLD. How to get information that not contain in document

    Hi,
    I need to get information of series number of some items previously sold to Customer. I have the CardCode of BP in Document and another ItemCode. Is it possible to get such  information (series number of other items) into Printing Layout?
    With regard
    Maxim Grunis

    Which document PLD do you refer to?  In general, you have to get them through UDF.  PLD is very basic reporting tool that do not easily link to anywhere.
    Thanks,
    Gordon

  • How to Get object that a JPanel belongs to.

    I created an object that has a JPanel. When that JPanel is clicked, how can I get the object to which its a GUI data member of?

    Hi,
    If you try JPanel.getParent() it will return the Container that it is in.
    If what you want is the creator you can derive from JPanel and add a constructor that has the creator as its only parm.
      JPanel panel = new JPanel(this);
    public class MyPanel extends JPanel {
      Object myCreator;
      public JPanel(Object creator) {
         super();
         myCreator = creator;
    }Now you can use myCreator to access that class that created it.
    Paul

  • How to get songs that are in "previous iTunes Libraries" folders ??

    I am unable to play scores and scores of songs that were on my iTunes 4.9 playlists now that I have "upgraded" to 7.0 I have a strange icon to the left of the song on my song list and when I go to play the song I get a message that the song cannot be located. The following notes come from iTunes help (see below) and I am wondering if anyone else has lost music and if so.....are they really lost or just misplaced? I would hate to think Apple would insist on an upgrade to buy more iTunes if they are going to scrub away hundreds of your other songs.
    HELP PLEASE
    Note: The library file name for versions of iTunes prior to 4.9 was "iTunes 4 Music Library" for Mac OS X and "iTunes 4 Music Library.itl" for Windows. After upgrading to iTunes 4.9 or later, the older library files are moved to a "Previous iTunes Libraries" folder.

    If the strange icon you refer to is an exclamation point, the problem is that the song files are not in the location the iTunes Library files are saying they are.
    Note that the iTunes Library files do not contain the actual song files but rather a list of references that point iTunes to where the songs are (or rather should be) located.
    So the first thing I'd do is find out just where the files are on your computer. Have a look at this article in the Apple Knowledge Base for some ideas on how to do so.
    Post back and let us know if you're able to find the song files.

  • How to increment array that contains two clusters whose visibility is controlled by a visible property node and selected by a radio button.

    I am trying to use a property node: visible in order to enable or disable one of two clusters. These clusters are in a larger cluster and this larger cluster is in an array. The two clusters are controlled by a radio button (one labeled transistor and the other diode). When diode is selected, the corresponding diode parameters cluster should be visible and when transistor is selected, the corresponding transistor parameters cluster should be visible. In the mean time, the cluster of the device that is not selected should not be visible. There are at least 45 elements in the array (but not more than 45). Data is entered into each cluster (diode or transistor data) for each element in the array via the increment/decrement. The problem is when you select the first radio button (transistor) and enter data, when you increment the array for a new device selection, since a visible property node was used on the cluster, a loop is created where a new cluster is trying to be shown, but the old cluster is also trying to be shown (because it is the one referenced by the property node. How do I get rid of this loop and still be able to increment the array and keep my data intact for future use? Attached is the vi
    Attachments:
    ChooseScan.vi ‏17 KB

    You could try something like this.  However, if you know how to use an xcontrol, that would be a better way to implement the above functionality so that these UI characteristics are not a part of your main VI.  The problem with the above VI is that you're looping every 100 ms just to update your UI.
    Also, try using the "disabled" property node, instead of the "visible" one.  That way, the user will still see the options he has but they will be grayed out.
    Message Edited by Sudhir Gopinath on 06-25-2007 04:45 PM
    S G
    Certified LabVIEW Architect, Certified TestStand Developer, Certified Professional Instructor
    Attachments:
    ChooseScan_1.vi ‏19 KB

  • How to get photos that are saved under Events in iPhoto to external drive

    Hi,
    I do photo slideshows on my Windows PC. I have all my photos under specific names Events in iPhoto on my Macbook Pro. How do I get a group of photos onto my Simpledrive external hard drive. I have tried to save it to desktop then drag the folder in the Simpledrive but it does not work.
    I was hoping someone out there could help me please.
    Thanks
    Dave

    Welcome to Apple Support Communities
    Mount the external drive and then open the destination folder
    Run iPhoto and select the Event then 'Select All' (command-a) and drag those items to the destination folder (just tested this on a zip drive and it worked as expected)
    Make sure the external drive is correctly formatted for the Mac to write to, while it can read NTFS it must be FAT32 for writing.

Maybe you are looking for