Remove xmlns="" from the response structure

Hi all,
This is the response which I get from the Webservice which I'm calling using the SAOP adapter
How can I remove xmlns="" from the sc and sm tags?
Input:
<Response xmlns="urn:com.xyz.xyz/platform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<error>
  <sc xmlns="">100</sc>
  <sm xmlns="">No Organizations found</sm>
  </error>
  </Response>
Expected Output structure:
<Response xmlns="urn:com.xyz.xyz/platform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<error>
  <sc>100</sc>
  <sm>No Organizations found</sm>
  </error>
  </Response>
Thanks,
Srini

Hi Srinivas,
Using Java mapping you can remove or add whatever the content to the XML message. Below is the code i am giving. Create a Jar file and upload into XI. This code you can test using SAP NWDS also. Put your XML message in C:\test\in.xml file and run it. you can check the desired output in out.xml.
package com.sap.wrap;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.AbstractTrace;
import java.util.Map;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.ByteArrayOutputStream;
public class truncate_namespace implements StreamTransformation {
     public static void main(String[] args) {
                                                  try {
                                                       InputStream in = new FileInputStream(new File("in.xml"));
                                                       OutputStream out = new FileOutputStream(new File("output.xml"));
                                                       truncate_namespace myMapping = new  truncate_namespace();
                                                       myMapping.execute(in, out);
                                                  } catch (Exception e) {
                                                       e.printStackTrace();
               String strXML = new String();
               int index = 0;
               AbstractTrace trace;
               private Map param = null;
               public void setParameter(Map param) {
                    this.param = param;
               public void execute(InputStream in, OutputStream out) {
                    int strBegin, strEnd;
                    String ns1String = new String();
                    String headerString = new String();
                    String outString = new String();
                    try {
                         //Convert InputStream to String
                         OutputStream temp = new ByteArrayOutputStream(1024);
                         byte[] buffer = new byte[1024];
                         for (int read = in.read(buffer); read > 0; read = in.read(buffer))
                              temp.write(buffer, 0, read);
                         strXML = temp.toString();
                         strXML = strXML.replaceAll(" xmlns=\"\">", ">");
                         outString = strXML;
                         out.write(outString.getBytes());
                    } catch (Exception e) {
Thanks & Regards
Vijayanand Poreddy

Similar Messages

  • How to remove xmlns="" from the message

    some reason on the header node in the below message gets xmlns="" when the message is generated from BPEL.
    below is the output that generated. I want to remove xmlns="" from the message.
    <?xml version="1.0" ?><ProductMovementReport xmlns="urn:cidx:names:specification:ces:schema:all:4:0" Version="4.0">
    <Header xmlns="">
    <ThisDocumentIdentifier>
    <DocumentIdentifier>42519</DocumentIdentifier>
    </ThisDocumentIdentifier>
    <ThisDocumentDateTime>
    Can anybody help me please ?

    It's is missing my blog article :-)
    Here it is:
    <?xml version="1.0" encoding="UTF-8" ?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="comment()|processing-instruction()|/"><xsl:copy><xsl:apply-templates/></xsl:copy></xsl:template><xsl:template match="*"><xsl:element name="{local-name()}"><xsl:apply-templates select="@*|node()"/></xsl:element></xsl:template><xsl:template match="@*"><xsl:choose><xsl:when test="name() != ''xmlns''"><xsl:attribute name="{local-name()}"><xsl:value-of select="."/></xsl:attribute></xsl:when></xsl:choose></xsl:template></xsl:stylesheet>';

  • How can we remove items from the VF04 list?

    We have a long list of items in VF04 that, for various reasons (some process related, some due to errors), are not to be billed. We have looked at applying filters to the list but there is nothing really suitable to hide these individual documents e.g. we could filter out some dates where none of the items on that date are to be billed but other dates have a mix of items we want to bill and others we don't.
    I have done a search of this forum but didn't find a previous topic with a quick and simple method to remove items from the list .
    Is there a method, other than billing them or sorting each issue individually, to permanently remove individual documents from the VF04 list?
    Thanks in advance for any help.
    David

    Hi,
    David,
    Download a list of Pending delivers doc form VF04.
    Paste the list in T.Code : VL09 (Delivery reversal) and reverse the delivery.
    Then go to T.Code: VL06G Select the list of deliveries that has been reversed, select/delete all un- wanted deliveries.
    This way you can remove all unwanted pending deliveries forn Billing due list (VF04).
    Thanks & Regards,
    R.Janakiraman

  • How do I remove items from the cloud without losing them permanently?

    My icloud storage is almost full. How do I remove items from the cloud and not lose them?

    What items?
    Purchased music, movies, TV shows, apps, and books do not use up your iCloud storage.
    See the link below for how to reduce the amount of storage you're using:
    http://support.apple.com/kb/HT4847

  • How do you remove items from the assets panel that are duplicated?

    How do you remove items from the assets panel that are duplicated?

    If you add an item to a slideshow, you'll usually see 2 entries for that image in the assets panel - one represents the thumbnail, and the other represents the larger 'hero' image.
    It sounds like you may have added the same image to your slideshow twice. You can select one of the hero images or thumbnail images in your slideshow and use the delete key to remove it. Then the extra 2 entries in the assets panel should disappear.

  • How do you remove items from the start up disc

    How do you remove items from the start up disc?

    Freeing Up Space on The Hard Drive
    You can remove data from your Home folder except for the /Home/Library/ folder.
    Visit The XLab FAQs and read the FAQ on freeing up space on your hard drive.
    Also see Freeing space on your Mac OS X startup disk.

  • How do I remove items from the dock?

    How do I remove items from the dock ?

    Single click and then drag it to the desktop. It will dissapear in a puff of smoke. You also may benefit by bookmarking and using:
    Find Out How Video tutorials

  • Can't remove items from the selectMenu

    I am using selectMenu as:
    <a4j:region selfRendered="true"  id="text">
                <h:selectOneListbox id="symbol" value="#{user.name}">
                  <f:selectItems value="#{user.temp_list}" />
              </h:selectOneListbox>
    <a4j:commandButton action="#{user.getData}" reRender="symbol" value="Get"/>
    </a4j:region>temp_list has following three values when page loads:
    temp_list.add(new SelectItem("Sunday"));
    temp_list.add(new SelectItem("Monday"));
    temp_list.add(new SelectItem("Tuesday"));Now in user.getData i want to remove items one by one based on the selection made by the user. The code is:
    temp_list.remove(0);
    this.setTemp_list(temp_list);But the problem is that if user selects Sunday for example, it remove it from the list but next time when user select Monday it removes monday but BRING BACK SUNDAY AGAIN IN THE LIST. Why is it so?

    BalusC wrote:
    I don´t understand you.Actually i was asking about the code which i mentioned in my last post.
    Okay then what could be the solution? What my thinking is that calling list.remove actually removes the item from the list permenantly, isn't it? If so then why does it showing me again in the selectMenu?

  • Can I remove items from the Services menu?

    I think the subject line says it all: can I remove items from the Services menu? I have a number of items in the Services menu that I never use and I would like to make the menu shorter to make it easier to access the items that I do use.

    There are a couple of things you could try. There's an application called Service Scrubber that is supposed to do this. But the web page says it's for 10.4, though it says it might work on 10.3
    Alternatively, you can edit the Info.plist or Info-macos.plist file in each application bundle to remove its service from the Services menu. This post at Mac OS X Hints has a pretty detailed description of how to do it. I tried this on my iMac running 10.3.9 and it worked just fine.
    Don't know about the Service Scrubber app, but if you edit the plist files, you'll need to log out and log back in before the changes take effect.
    Also, if you decide to edit the files by hand, I'd suggest just renaming NSServices by adding an "x" to the front or something, rather than deleting the item completely. That makes the changes easier to reverse.
    charlie

  • How do I remove computers from the authorized list

    Has anyone been able to remove computers from the authorized list without waiting to get 5 then removing all? I have had 3 computers die and need to have only my two new ones listed

    You can only remove them when you hit 5 authorized. Normally you go to Store>Deauthorize this computer.
    Without computer you go to itunes program>itunes store>Account on right>Deauthorize all. Will have to hit 5 to have the option though.

  • How do you remove recipients from the To list?

    Say you want to send an email to multiple recipients. You add a few recipients to the To list but then change your mind about including one of them. How do you remove one from the list? So far the only way I can see is go cancel the whole message and start again.

    Touch the persons name you wish to remove. It will highlight in blue. Then hit the destructive backspace (delete) key on the keyboard.

  • Wanted to put a file via a drag and drop into applications on my finder sidebar.  it missed and landed in the sidebar itself.  i can not remove it.  i can not even highlight it.  how can i remove it from the sidebar.

    I wanted to put a file via a drag and drop into applications on my finder sidebar.  it missed and landed in the sidebar itself.  i can not remove it.  i can not even highlight it.  how can i remove it from the sidebar.

    Try holding down the Command key and dragging the file well off the sidebar.
    Hope this helps.

  • How can I remove files from the startup disk

    I am getting a screen when I am trying to quit saying   the "MAC OS X startup disk has no more space available for application memory"  by closing the windows and removing files from the startup disk will help.
    How do I do this?

    That error message is misleading. Your problem is excessive swapping of data between physical memory and virtual memory.
    That can happen for two reasons:
    You have a long-running process with a memory leak (i.e., a bug), or
    You don't have enough memory installed for your usage pattern.
    Tracking down a memory leak can be difficult, and it may come down to a process of elimination.
    In the Activity Monitor application, select All Processes from the menu in the toolbar, if not already selected. Click the heading of the  Real Mem column in the process table twice to sort the table with the highest value at the top. If you don't see that column, select
    View ▹ Columns ▹ Real Memory
    from the menu bar.
    If one process (excluding "kernel_task") is using much more memory than all the others, that could be an indication of a leak. A better indication would be a process that continually grabs more and more real memory over time without ever releasing it. Here is an example of how it's done.
    The process named "Safari Web Content" renders web pages for Safari and other applications. It uses a lot of memory and may leak if certain Safari extensions or third-party web plugins are installed. Consider it a prime suspect.
    If you don't have an obvious memory leak, your options are to install more memory (if possible) or to run fewer programs simultaneously.
    The next suggestion is only for users familiar with the shell. For a more precise, but potentially misleading, test, run the following command: 
    sudo leaks -nocontext -nostacks process | grep total
    where process is the name of a process you suspect of leaking memory. Almost every process will leak some memory; the question is how much, and especially how much the leak increases with time. I can’t be more specific. See the leaks(1) man page and the Apple developer documentation for details.

  • HOw Can I remove faces from the URL

    I know that it's in the web.xml file but as soon as i remove the faces part from the file nothing works. Someone please tell me how to properly remove "faces" from the url. Example http:.//localhost:8080/croot/Page1.jsp
    Thanks in advance

    I know that it's in the web.xml file but as soon as i remove the faces part from the file nothing works. Someone please tell me how to properly remove "faces" from the url. Example http:.//localhost:8080/croot/Page1.jsp
    Thanks in advance

  • How can i remove comments from the "tell your frie...

    How can I remove comments from the "tell your friends how you're doing" section?

    Please do a Skype reset.
    Exit Skype : From the system tray >> right click on the skype icon and click "Quit"
    Press WinKey+R
    Type: %appdata% and press Enter.
    Rename the folder "Skype" to "Old_Skype"
    Run Skype.
    You will need your password to re-log on, and re-set any options from default
    Regards,
    Tamim
    Location - Dhaka | Bangladesh - Standard Time Zone: GMT/UTC + 06:00 hour
    If one of my replies has adequately addressed your issue, please click on the “Accept as Solution” button. If you found a post useful then please "Give Kudos" at the bottom of my post, so that this information can benefit others.

Maybe you are looking for

  • In Pages 5.5.3, How to stop automatic numbering of Lines & Paragraphs?

    How can I stop the A. B. on the extreme left of the page? Anything I try screws up the rest of the formatting. I see nothing in Prefernces to stop this.

  • Oracle bi publisher report for apex - Report Layout

    Hi There, Navigation: Home>Application Builder>Application 20>Shared Components>Report Layouts I created rtf template for a Report Query. It worked fine upto certain point. However at some point, if I make a minor modification to the layout it is not

  • Implement check for File Names with data into TRG table

    hi, I am trying to load the Multiple files names & Autonumber to oracle table T1 which is further loaded the auto-number with data to target table TRG. My problem is when the same name file comes again due to size then load it again. & also don't ins

  • How to get the following output

    Table 1                                        Table 2     EmpCode    EmpName        EmpCode EmpPhone 10001         ABC                    10001    12345 10002         BCD                    10001    23456 10003         CDE                    10001  

  • Dynamic Tabs in JSF using tabbedPane

    I want to create tabs from the list retreived from DB. How to do Can anyone explain