XML Deserialization

Hello,
I used Xsd2Code version 3.4.0.38967 in order to generate a Xml Serialize / Deserialize model for an xml file.
Sometimes the code works fine, sometimes the following error is reported at the deserialization process : "Error in Xml Document (0,0) : Root element not found ".
This is the generated code :
LoadMethod()
System.IO.FileStream file = null; System.IO.StreamReader sr = null;
try
file = new System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read);
sr = new System.IO.StreamReader(file);
string xmlString = sr.ReadToEnd();
sr.Close();
file.Close();
return Deserialize(xmlString);
finally{
if ((file != null))
file.Dispose();
if ((sr != null))
sr.Dispose();
public static LocaleElement Deserialize(string xml)
System.IO.StringReader stringReader = null;
try
stringReader = new System.IO.StringReader(xml);
// here the exception is reported !!!!
return ((LocaleElement)(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader))));
finally
if ((stringReader != null))
stringReader.Dispose();
private static System.Xml.Serialization.XmlSerializer Serializer
get
if ((serializer == null))
serializer = new System.Xml.Serialization.XmlSerializer(typeof(TextStyleCategory));
return serializer;
After some research i detected that this problem comes because the Deserialize method does not find the stream in a valid position and cannot read from it . However i had not found any reference that XmlReader.Create(stringReader) does this thing.
I changed the code for the deserialize method with the following :
public static TextStyleConf Deserialize(string xml)
System.IO.StringReader stringReader = null;
try
stringReader = new System.IO.StringReader(xml);
return (LocaleElement)(Serializer.Deserialize(stringReader));
finally
if (stringReader != null)
stringReader.Dispose();
This does not reports the problem anymore....however i don't know exactly if this is a good solution. I would like to receive a second opinion on the matter. Thank you

Hi,
Xsd2Code is the 3th part product. You should go to the link to post your thread:
https://xsd2code.codeplex.com/workitem/list/basic
Best Wishes!
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. <br/> Click <a
href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

Similar Messages

  • XML Deserialization error while consuming Enterprise service in wd java..

    Hello,
    I am trying to build 2 webdynpro java webdynpro applications which consumes enterprise service for purchase order and another application for Busines partner.
    While i was able to successfully consume the PO service in webdynpro java and get the desired output for PO..i get XML Deserialization error while running appliation for Business Partner..
    These are the details/steps i followed for the Business Partner application:
    1. After creating the model using the enterprise service, i created a service controller from the model to the component controller..
    2. Out of many inputs/output attributes during mapping from model to component controller. i further mapped the context from CC to ViewC.
    3. In the wdDoInit() method, i added the follwing code:
        BPCreate model1 = new BPCreate();
        Request_BusinessPartnerERPCreateRequestConfirmation_In RequestC = new  Request_BusinessPartnerERPCreateRequestConfirmation_In(model1);
        BPERPCrteReqMsg_S CreateMessage = new BPERPCrteReqMsg_S(model1);
        BPERPCrteReq_SBP Cpartner = new BPERPCrteReq_SBP(model1);
    String Category = new String();
        String lf = new String();
        Cpartner.setInternalID(new String());
        Cpartner.setNumberRangeIntervalBusinessPartnerGroupCode(new String());
        Cpartner.setLifeCycleStatusCode(lf);
        Cpartner.setCategoryCode(Category);   
        CreateMessage.setBusinessPartner(Cpartner);
        RequestC.setBusinessPartnerERPCreateRequestMessage_Sync(CreateMessage);
        wdContext.nodeBusinessPartnerERPCreateRequestMessage_Sync().bind(CreateMessage);
    4. When i comment this code and run the application, the aplication comes up but the input fields are non-editable..
    5. If i place this code in wdDoInit() method, i get the Deserialization error..
    Any idea about why this error occurs and which areas in the application can lead to these errors?
    I checked that the service runs fine in soamanager.
    Thanks, JVR

    Hi Kishore,
    This error is majorly because while executing this Webdynpro application you are not entering all the mandatory fileds of WS.
    Please try to execute this WS from WS-Navigator, check which fileds are mandatory and then
    appropriately instantiate it in wdDoInit and pass all the fields required.
    Regards,
    Vaibhav Modi.

  • Web Service: XMLUnmarshalException: XML Deserialization Error

    Hi,
    I am trying to use a complex web structure in web service.
    I am simply trying to display some data from that web service in my view.
    I am getting the foll error:
    <b>
    Service call exception; nested exception is:
         com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML is not valid. Element [http://www.siebel.com/xml/Account Interface]<Account> is required in <SiebelMessage> but can not be found.[Ljava.lang.StackTraceElement;@2fe4e7
    </b>
    I have gone thru most of the posts but they all have XMLMarshalException and not XMLUnmarshalException.
    Any inputs please?
    Regards,
    Dev

    Hi Bala,
    I tried your suggestion but that did not work!
    I am not trying to test that web service via WSNavigator.
    Problem is my service does not come there once i deploy it.
    I am a newbie to WebServices so please correct me where am I wrong in these steps:
    1. I create a Deployable Proxy Project
    2. Then, i create a new Client Proxy Definition
    3. I enter pkg name, Proxy name, choose Local System. Then i give the WSDL location and finally press Finish.
    (It has created several files including ClientAPI.jar)
    4. Lastly, i chose Build EAR and deployed it.
    But i cannot see my web service in that list!
    Can you please help me in checking the request-response cycle for this web service.
    Regards,
    Dev

  • Problem with XML Deserialization Error

    Hi! when I test my webservice, I take the following error: Deserializing fails. Nested message: XML Deserialization Error. Result class com.sap.gram.SelRec.SelRec_CompGenModel does not have property of type java.lang.String. It is required to load XML..
    I don´t understand why occur this!! CiEntId is a string with the property of a primaryKey
    What can I do??
    Thanks
    Rose

    Hi Rosa,
    I've got the same error message, but in another scenario. I'm testing a XI Web Service, with a defined WSDL. To test it I'm using WS Navigator (http://host:port/wsnavigator/enterwsdl.html). Although all the types I'm returning are on the WSLD definition, the dumb WS Navigator fires the "XML Deserialization Error", and says that a type is not defined in the wsdl (but the type is there, and other test tools are working fine with it!).
    roberti

  • XML Deserialization Error

    Hi,
    I'm workin on a prototyp based on the netweaver developer studio preview. after i've steped to the several tutorial for webservices und webdynpro.
    I've implemented a ejb/webservice combination for selecting a insurance contract from our databases based on existing java-classes to use the webservice as a model in the webdynpro-app. So fare everything worked fine.
    Know I've made a little change and filled the contract with aditional information about the customer to this contract (i didn't modified the class if just filled e member of the contract which was null bevor). After deploying the webservice i got the following error message:
    Service call exception; nested exception is: com.sap.engine.services.werservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML is not valid. Element [urn:de.deutscherring.base]<nummer> is required in <ns16:personVn> but can not be found.
    When i test the webservice i get the same error.
    I've searched a the classes which a direct or indirect owned by the Person-Object and found only on member named nummer but it's an int, which can't cause trouble with deserialization.
    Are anyone their wo can help me?
    Thanks in advance.
    Oliver

    Hi Oliver,
    Check what is the request and the response. Where does the deserialization fail - on the client or on the server side?
    <i>You can increase the severity of your web service location via the Visual Admin and Log Configurator Service to debug in order to log also the request and response messages (Location: com.sap.engine.services.webservices.runtime...)</i>
    If the response is fine, then maybe your WS Client Proxy needs to be regenerated in order to reflect your change.
    Otherwise, please create a CSN message.
    Best regards,
    Alexander

  • Web Service:  XML Deserialization Error

    Hallo experts
    I call one service on the SAP Applikation server (7.1 Enhancement) and get the following error:
    com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. Empty node passed to deserializer com.sap.engine.services.webservices.jaxrpc.encoding.primitive.DateTimeSD which is not acceptable.&#13;
    If I use the SOAP to call the service I got the answer as following:
    has no value. Is this the reason that causes this problem?  If it is, how can I get the result in this case withoutrthis error. Because we get always Items from the backend that some fields were not filled.
    Thanks a lot and
    Nice regards!
    Ping

    Hi Bala,
    I tried your suggestion but that did not work!
    I am not trying to test that web service via WSNavigator.
    Problem is my service does not come there once i deploy it.
    I am a newbie to WebServices so please correct me where am I wrong in these steps:
    1. I create a Deployable Proxy Project
    2. Then, i create a new Client Proxy Definition
    3. I enter pkg name, Proxy name, choose Local System. Then i give the WSDL location and finally press Finish.
    (It has created several files including ClientAPI.jar)
    4. Lastly, i chose Build EAR and deployed it.
    But i cannot see my web service in that list!
    Can you please help me in checking the request-response cycle for this web service.
    Regards,
    Dev

  • XmlUnmarshalException: XML Deserialization Error

    Hi, I have generated a Deployable WebService Proxy of a external WebService from the Provider ESRI (http://arcweb.esri.com/arcwebonline/index.htm) with SAP Dev Studio SP9 and deployed to the WAS 6.40 SP9.
    Within a Servlet i called first the WebService Authentication to get a Token which works fine and then the WebService AddressFinder.findAddress() to get the Datas but this Call throw a Exception
    ==> "Service call exception; nested exception is:
    com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML is not valid. Element []<errorCode> is required in <soap:Body> but can not be found."
    The required element <errorCode> descriped in the WDSL Definition is nillable="true" so not required!
    - <xsd:complexType name="LocationInfo">
    - <xsd:sequence>
      <xsd:element name="matchType" nillable="true" type="xsd:string" />
      <xsd:element name="candidates" nillable="true" type="ns12:ArrayOfLocation" />
      <xsd:element name="hasMore" type="xsd:boolean" />
      <b><xsd:element name="errorCode" nillable="true"</b> type="xsd:string" />
      </xsd:sequence>
      </xsd:complexType>
    I checked also the SOAP response on the J2EE which was ok:
    Message : HTTP/1.1 200 OK
    Server: Sun-ONE-Application-Server/7.0
    Date: Wed, 12 Jan 2005 10:11:31 GMT
    Content-length: 1534
    Content-type: text/xml; charset=UTF-8
    Optimizable: true
    Connection: close
    <?xml version='1.0' encoding='UTF-8'?>
    <soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' soap:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:ns5='http://www.themindelectric.com/package/com.esri.is.services.common.v2/' xmlns:ns6='http://www.themindelectric.com/package/com.esri.is.services.common.v2.geom/'><soap:Body><n:findAddressResponse xmlns:n='http://arcweb.esri.com/v2'><Result href='#id0'></Result></n:findAddressResponse><id0 id='id0' soapenc:root='0' xsi:type='ns5:LocationInfo'><matchType xsi:type='xsd:string'>EXACT</matchType><candidates href='#id1'></candidates><hasMore xsi:type='xsd:boolean'>false</hasMore></id0><id1 id='id1' soapenc:root='0' xsi:type='soapenc:Array' soapenc:arrayType='ns5:Location[1]'><i href='#id2'></i></id1><id2 id='id2' soapenc:root='0' xsi:type='ns5:Location'><point href='#id3'></point><description1 xsi:type='xsd:string'>Ammann Strasse 2, 3074, Muri Bei Bern</description1><score xsi:type='xsd:double'>0.0</score><matchType xsi:type='xsd:string'>100</matchType></id2><id3 id='id3' soapenc:root='0' xsi:type='ns6:Point'><x xsi:type='xsd:double'>7.496564</x><y xsi:type='xsd:double'>46.926945</y><coordinateSystem href='#id4'></coordinateSystem></id3><id4 id='id4' soapenc:root='0' xsi:type='ns6:CoordinateSystem'><projection xsi:type='xsd:string'>4326</projection></id4></soap:Body></soap:Envelope>
    Is there anything wrong, has anybody a solution?
    Thanks Vince

    Hi Vilish,
    I have a Web Dynpro application that uses a Web Service model. The Web Service is located on a remote non-SAP server, and i generated proxies based on its WSDL.
    The error occurs at this procedure,
    someElementObj.modelObject.execute();
    This procedure is to send a request with parameters to a Web method, and then retrieving data from the response XML before storing the data in the model context. So, I suspect this happens during retrieving process.
    Thanks,
    Teecheu

  • XmlUnmarshalException: XML Deserialization Error Please Help!!!

    Hi All,
    I am consuming the standard webservice
    Name: /SAPAPO/SDM_PARCRTRC
    I am getting the following error on execution of the web service:
    Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML is not valid. Element []<ScheduleLine> is required in <NameSpecification> but can not be found.
    Please help me with this problem.
    Thanks in Advance.

    Hi All,
    Thanks for your replies.
    They were helpful but this what I did that solved the problem
    I used the following code to set the required parameters
    item.getOriginalBean().setScheduleLine(new ScheduleLineInner[] {scheduleLine.getOriginalBean()});
    instead of
    item.addScheduleLine(scheduleLine);
    Similarly all the parameters were set using the orginalBean
    Now it is working perfectly fine....
    Thanks a lot..
    Setu

  • XML Deserialization Error when calling WebService from WebDynrpo

    Hi all,
    when calling a WebService-method from my WebDynpro-application, I get the following error message:
    "Deserializing fails. Nested message: XML Deserialization Error. Can not create instance of class [com.karmann.ApplMan.dto.SoftwareKomponenteDTO] when deserializing XML type [urn:com.karmann.ApplMan.dto][SoftwareKomponenteDTO].."
    SoftwareKomponenteDTO is a class that I have implemented. It implements Serializable and overwrites the methods "equals()" and "hashcode()". It contains members of types long, String and java.sql.Date.
    The method I call needs an argument of type SoftwareKomponenteDTO. Other methods which return something of type SoftwareKomponenteDTO do not make any problems.
    The same error message appears when I test the WebService-method in the WebService-navigator. So I assume that the problem is not the way I call the method from WebDynpro.
    Thanks for help,
    Christoph

    Thanks for this hint, Amar. But this points directly to my next problem: How can I set this parameter. I know how to set flat parameters (e.g. of type long, boolean, etc.). But how can I set a parameter of a complex type?
    For example I can call
        wdContext.currentSaveElement().setIdFather(long id)
    in order to set the parameter idFather of type long for the WebService-method save(). But there is no method
         wdContext.currentSaveElement().setIdFather(SoftwareKomponenteDTO aKomp)
    Could you please help me on more time?
    Kind regards,
    Christoph

  • XML Deserialization Error when calling WebService-method

    Hi all,
    when calling a WebService-method from my WebDynpro-application, I get the following error message:
    "Deserializing fails. Nested message: XML Deserialization Error. Can not create instance of class [com.karmann.ApplMan.dto.SoftwareKomponenteDTO] when deserializing XML type [urn:com.karmann.ApplMan.dto][SoftwareKomponenteDTO].."
    SoftwareKomponenteDTO is a class that I have implemented. It implements Serializable and overwrites the methods "equals()" and "hashcode()". It contains members of types long, String and java.sql.Date.
    The method I call needs an argument of type SoftwareKomponenteDTO. Other methods which return something of type SoftwareKomponenteDTO do not make any problems.
    The same error message appears when I test the WebService-method in the WebService-navigator. So I assume that the problem is not the way I call the method from WebDynpro.
    Thanks for help,
    Christoph

    Hi all,
    I found what my problem was. The complex type that I deliver to my method (i.e. SoftwareKomponenteDTO) must have a public constructor without parameters. I think that this is slightly confusing, because in the other direction (method delivers complex type as return value) this is not neccessary. Anyway, my problem's solved now.
    Regards,
    Christoph

  • XML-Deserialize with JAXB

    Hello!
    I'm new to JAXB so maybe my question is a newbie question.
    Why can I deserialize the following XML:
    <ns3:vida xmlns:ns3="http://cpsnet.de/dms/schnittstellen/volvo/vida_dms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    </ns3:vida> but I can't deserialize this one:
    <vida xmlns="http://cpsnet.de/dms/schnittstellen/volvo/vida_dms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    </vida>As far as I understand XML right now, they are both the same. Aren't they?
    The Unmarshaller returns the Object for the first XML - but returns null on the second one...

    Well... once again this was a ClassLoader problem... solved!

  • Error while XML deserialization using ST

    Hi Experts,
    I am generating a fancy XML Spreadsheet using Simple Transformation and then trying to read it back using the same ST (deserialization).
    While doing so, I am receiving following runtime error:
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_ST_MATCH_ELEMENT', was not caught and therefore
    caused a runtime error.
        The reason for the exception is: XML matching error
        Expected was element-start: "Workbook" [urn:schemas-microsoft-com:office:spreadsheet]
        Read was document-end: " " [ ].
    Althought, the XML contains the same line at line #3 below:
    <?xml version="1.0"?>
    <?mso-application progid="Excel.Sheet"?>
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:o="urn:schemas-microsoft-com:office:office"
    xmlns:x="urn:schemas-microsoft-com:office:excel"
    xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    xmlns:html="http://www.w3.org/TR/REC-html40">
    <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
      <Created>2009-05-18T05:28:50Z</Created>
      <LastSaved>2009-05-18T05:28:50Z</LastSaved>
      <Version>11.9999</Version>
    </DocumentProperties>
    <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
    I tried aligning the text / transformation in various ways with no success.
    Any clues to tackle this?

    Not required anymore, closing the thread.

  • XML deserialize and decrypting encoding problem. Please help me

    This is my first topic here, so at first I'd like to say "Hi" everyone and apologise for my bad english ;)
    I have just finished my new application about signing/checking and encrypting/decrypting XML files. I use Apache XML Security packages to do this.
    Everything works fine, instead of one...
    I'm Polish and sometimes I have to encrypt or decrypt XML which includes polish letters like: '&#261;' , '&#281;', '&#322;' and some others... If I encrypt such file, it succeeds. The problem is when I try to decrypt such an encrypted file. I recieve an error like :
    "[Fatal Error] :2:7: An invalid XML character (Unicode: 0x19) was found in the element content o
    f the document.
    gov.mf.common.exceptions.SenderException: E_SENDER_DECRYPTION
    at gov.mf.common.xml.encryption.EncryptTool.decrypt(Unknown Source)
    at gov.mf.CERBER.TestCBR.main(Unknown Source)
    Caused by: org.apache.xml.security.encryption.XMLEncryptionException: An invalid XML character
    (Unicode: 0x19) was found in the element content of the document.
    Original Exception was org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x19)
    was found in the element content of the document.
    at org.apache.xml.security.encryption.XMLCipher$Serializer.deserialize(Unknown Source)
    at org.apache.xml.security.encryption.XMLCipher.decryptElement(Unknown Source)
    at org.apache.xml.security.encryption.XMLCipher.doFinal(Unknown Source)
    ... 2 more
    What's wrong? My XML document is UTF-8 encoded, with or without BOM. I wrote in in Notepad++ or any other editior which has UTF-8 encoding.
    I'm parsing my XML with DOM. There is an interesting line in an error above like: " at org.apache.xml.security.encryption.XMLCipher$Serializer.deserialize(Unknown Source)" , do you know that?
    Everything is fine when I try to encrypt/decrypt '�' or '&#324;', but things go wrong with '&#261;', '&#281;', '&#322;' and others... I also managed to encrypt and decrypt '&#322;' but unfortunately, after decryption '&#322;' turns into 'B'. It obviously an encoding problem, but how to fix it?
    I would be really thankfull if some of You guys would help me.
    Looking forward fo any answers.
    Matthew
    Message was edited by:
    matthew_pl

    Hi once again.
    I still don't havy any solution to my problem. I used Apache XML Security examples to encrypt/decrypt my XML document with Polish charaters but I also recieve the same error. What's wrong?
    Here is some code:
    ----- Parsing XML do Document ------
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         //Bardzo wazna linijka - bless TEK ;)
         factory.setNamespaceAware(true);
         DocumentBuilder builder;
         builder = factory.newDocumentBuilder();
         File f = new File(Const.FILE_IN_PATH + File.separator + Const.FILE_IN);     
         org.w3c.dom.Document doc = builder.parse(f);
    ---------- Encrypting & Decrypting XML document (whole class) -------------
    import java.io.*;
    import java.security.*;
    import javax.crypto.SecretKey;
    import javax.crypto.SecretKeyFactory;
    import javax.crypto.spec.DESedeKeySpec;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.apache.xml.security.keys.KeyInfo;
    import org.apache.xml.security.utils.EncryptionConstants;
    import org.apache.xml.security.encryption.XMLCipher;
    import org.apache.xml.security.encryption.EncryptedData;
    import org.apache.xml.security.encryption.EncryptedKey;
    public class EncryptTool
    private PublicKey publicKey;     
    private PrivateKey privateKey;
    static
    org.apache.xml.security.Init.init();
    public EncryptTool()
         publicKey = KeyStores.getCerberPublicKey();
         privateKey = KeyStores.getCerberPrivateKey();
    public Document encrypt(Document doc, String sufix)
    try
         byte[] passPhrase = "24 Bytes per DESede key!".getBytes("UTF-8");
         DESedeKeySpec keySpec = new DESedeKeySpec(passPhrase);
         SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
         SecretKey secretKey = keyFactory.generateSecret(keySpec);
         XMLCipher keyCipher = XMLCipher.getInstance(XMLCipher.RSA_v1dot5);
         keyCipher.init(XMLCipher.WRAP_MODE, publicKey);
         EncryptedKey encryptedKey = keyCipher.encryptKey(doc, secretKey);
              Element elementToEncrypt = (Element) doc.getDocumentElement();
              System.out.println("Szyrfuj&#281;: " + elementToEncrypt.getTextContent());
              XMLCipher xmlCipher = XMLCipher.getInstance(XMLCipher.TRIPLEDES);
              xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
              EncryptedData encryptedDataElement = xmlCipher.getEncryptedData();
              KeyInfo keyInfo = new KeyInfo(doc);
              keyInfo.add(encryptedKey);
              encryptedDataElement.setKeyInfo(keyInfo);
              boolean encryptContentsOnly = true;
              xmlCipher.doFinal(doc, elementToEncrypt, encryptContentsOnly);
              // output the resulting document
              String [] parts = Const.FILE_IN.split("\\.");
              String saveAs = Const.FILE_OUT_PATH + File.separator + parts[0] + sufix + "." + parts[1];
              OutputStream os = new FileOutputStream(saveAs);
              XMLUtil.sameXMLtoFile(doc, os);
    } catch (Exception ex)
         throw new TestCBRException("E_CERBER_ENCRYPTION", ex);
    return doc;
    public void decrypt(Document doc, String sufix) throws SenderException
    try
              String namespaceURI = EncryptionConstants.EncryptionSpecNS;
         String localName = EncryptionConstants._TAG_ENCRYPTEDDATA;
         int ile = doc.getElementsByTagNameNS(namespaceURI, localName).getLength();
         if (ile == 0) throw new SenderException("E_SENDER_DECRYPTION_NEEDED");
         for(int i=0; i < ile; i++)
         Element encryptedDataElement = (Element) doc.getElementsByTagNameNS(namespaceURI, localName).item(0);
         XMLCipher xmlCipher = XMLCipher.getInstance();
         xmlCipher.init(XMLCipher.DECRYPT_MODE, null);
         xmlCipher.setKEK(privateKey);
         xmlCipher.doFinal(doc, encryptedDataElement);
                   String [] parts = Const.FILE_IN.split("\\.");
                   String saveAs = Const.FILE_OUT_PATH + parts[0] + sufix + "." + parts[1];
                   OutputStream os = new FileOutputStream(saveAs);
                        XMLUtil.saveXMLtoFile(doc, os);
    } catch (SenderException ex) {
         throw ex;
    } catch (Exception ex) {
         throw new SenderException("E_SENDER_DECRYPTION", ex);
    Please help me. I'm going into madness what's wrong with it...

  • Xml deserialization and namespace issue.

    I have an xml file something like:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <NS1:NodeA xmlns:NS1="FooSpace">
    <NS1:NodeB>
    <NS1:NodeC>
    <NS1:ElementA>text</NS1:ElementA>
    </NS1:NodeC>
    <NS1:NodeD>
    <Attributes>
    <Name>xxx</Name>
    <Value>yyy</Value>
    </Attributes>
    <Attributes>
    <Name>www</Name>
    <Value>zzz</Value>
    </Attributes>
    </NS1:NodeD>
    </NS1:NodeB>
    </NS1:NodeA>
    I can parse every thing upto the contents of NodeD. For the classes which expose elements (NodeA to NodeD), I decorate the properties as follows:
    [XmlElement("property_name", Namespace = "FooSpace")]
    The Attributes class has properties without the Namespace key.
    Anyone know what I am missing?
    Thanks!

    I am glad to know you solved this problem and thanks for sharing the solution.
    It will be very beneficial for other community members who have the similar questions.
    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.
    Click
    HERE to participate the survey.

  • How To Debug XML Serialization Error while deploy web services

    <b>My Scenario</b>
    I've created a Java Projects with a Class. From there I convert it to Web Service by creating the virtual interface, the web services definition and the web service configuration. After that I deploy to the SAP WAS (SP11). At this instant I only try to deploy the web services with the intension to modify it later for GP to invoke.
    <b>Result</b>
    When deployment the Web Service I get an XML Deserialization error. Error text is below.
    <b>Question</b>
    How do I go about debugging this? What logs are good starting point? Can I capture the entire SOAP response message somehow?
    Thanks
    <b>
    Error Test</b>
    Caused by: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML Node [VirtualInterface.Functions][http://xml.sap.com/2002/10/metamodel/vi] have minOccurs>0 in schema definition but is missing in node [VirtualInterface][http://xml.sap.com/2002/10/metamodel/vi].
                              at com.sap.engine.services.webservices.jaxrpc.encoding.GeneratedComplexType._loadInto(GeneratedComplexType.java:1197)
                              at com.sap.engine.services.webservices.jaxrpc.encoding.GeneratedComplexType.deserialize(GeneratedComplexType.java:945)
                              at com.sap.engine.services.webservices.server.deploy.descriptors.vi.VInterfaceParser.getVInterface(VInterfaceParser.java:46)
                              at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseVI(WSDefinitionFactory.java:920)
                              ... 27 more
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.update(DeployServiceImpl.java:681)
                              at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1278)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
                              at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
                              at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
                              at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
                              at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
                              at java.security.AccessController.doPrivileged(Native Method)
                              at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
                              at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
                         Caused by: java.lang.Exception: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Webservices common deployment exception! The reason is: Error occurred, trying to update web services for application sap.com/TimeoffService. . Additional info: none
                              at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.updateWebServices(WSUpdateProcessor.java:164)
                              at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.updateWebServices(WSUpdateProcessor.java:118)
                              at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.updateWebServices(WSUpdateProcessor.java:86)
                              at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateManager.makeUpdate(WSUpdateManager.java:52)
                              at com.sap.engine.services.webservices.server.deploy.WSDeployer.makeUpdate(WSDeployer.java:274)
                              at com.sap.engine.services.deploy.server.application.UpdateTransaction.makeComponents(UpdateTransaction.java:400)
                              at com.sap.engine.services.deploy.server.application.DeployUtilTransaction.commonBegin(DeployUtilTransaction.java:321)
                              at com.sap.engine.services.deploy.server.application.UpdateTransaction.begin(UpdateTransaction.java:164)
                              at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:292)
                              at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:326)
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.makeGlobalTransaction(DeployServiceImpl.java:3184)
                              at com.sap.engine.services.deploy.server.DeployServiceImpl.update(DeployServiceImpl.java:669)
                              at com.sap.engine.services.deploy.server.DeployServiceImplp4_Skel.dispatch(DeployServiceImplp4_Skel.java:1278)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:320)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:198)
                              at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129)
                              at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
                              at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
                              at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
                              at java.security.AccessController.doPrivileged(Native Method)
                              at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
                              at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
                         Caused by: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Webservices deployment exception! The reason is: Error occurred, trying to generate web services deployment files for application sap.com/TimeoffService. . The error refers to application: none, jar: , web service: .
                              at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.generateDeployFiles(WSUpdateProcessor.java:296)
                              at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.deployWebServices(WSUpdateProcessor.java:262)
                              at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.updateWebServices(WSUpdateProcessor.java:155)
                              ... 21 more
                         Caused by: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Webservices common deployment exception! The reason is: Error occurred, parsing com.sap.engine.services.webservices.server.deploy.descriptors.sapwebservices.WSDescriptor descriptor, application sap.com/TimeoffService, web service timeoffServiceConfig, location message: type: jar file, location: E:\usr\sap\SIC\DVEBMGS01\j2ee\cluster\server0\.\temp\deploy\work\deploying\reader1186995503687\TimeoffService.wsar . . Additional info:
                              at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseWSDescriptor(WSDefinitionFactory.java:907)
                              at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.loadWebService(WSDefinitionFactory.java:176)
                              at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.loadWebServices(WSDefinitionFactory.java:158)
                              at com.sap.engine.services.webservices.server.deploy.ws.update.WSUpdateProcessor.generateDeployFiles(WSUpdateProcessor.java:284)
                              ... 23 more
                         Caused by: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Webservices common deployment exception! The reason is: Error occurred, trying to parse source type: zip entry, zip file location: E:\usr\sap\SIC\DVEBMGS01\j2ee\cluster\server0\.\temp\deploy\work\deploying\reader1186995503687\TimeoffService.wsar, entry: dsta/timeoff/test/business/TimeoffServiceVI.videf . Additional info:
                              at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseVI(WSDefinitionFactory.java:925)
                              at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseWSDescriptor(WSDefinitionFactory.java:817)
                              ... 26 more
                         Caused by: com.sap.engine.services.webservices.jaxrpc.exceptions.XmlUnmarshalException: XML Deserialization Error. XML Node [VirtualInterface.Functions][http://xml.sap.com/2002/10/metamodel/vi] have minOccurs>0 in schema definition but is missing in node [VirtualInterface][http://xml.sap.com/2002/10/metamodel/vi].
                              at com.sap.engine.services.webservices.jaxrpc.encoding.GeneratedComplexType._loadInto(GeneratedComplexType.java:1197)
                              at com.sap.engine.services.webservices.jaxrpc.encoding.GeneratedComplexType.deserialize(GeneratedComplexType.java:945)
                              at com.sap.engine.services.webservices.server.deploy.descriptors.vi.VInterfaceParser.getVInterface(VInterfaceParser.java:46)
                              at com.sap.engine.services.webservices.server.deploy.ws.WSDefinitionFactory.parseVI(WSDefinitionFactory.java:920)
                              ... 27 more
                              at com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException.writeReplace(WSDeploymentException.java:64)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                              at java.lang.reflect.Method.invoke(Method.java:324)
                              at java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:896)
                              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)
                              at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
                              at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
                              at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
                              at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
                              at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
                              at com.sap.engine.services.rmi_p4.DispatchImpl.throwException(DispatchImpl.java:144)
                              at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:322)
                              ... 8 more

    Hi Paul..
       This is a common problem when you are working with webservices, i have worked with them and not always the response of the ws comes like de wsdl says, depends of your wsdl provider.
       I suggest you that checks your response of your webservice with the Enterprise Portal Web Services Checker View
      For see this view in NetWeaver go to Window > Show View > Other > Enterprise Portal Web Services Checker
      Put the wsdl url definition in wsdl url textbox
    and the click in the letter W, this procedure brings you all methods and everything for play with the WEB Services.. and you can check the response of you webservices call funtion, checks that all the tags comes like says in the wsdl
    Good luck
    Joshua

Maybe you are looking for

  • PL/SQL TABLE AS A PARAMETER TO PSP

    Hello ! In a PSP application one of the pages is retrieving rows more than 10, and the limitation for the same is to display only 10 rows a page. Same can be done using OWA_UTIL but only if you are having a query to pass as one of the parameters. I'm

  • GUI_DOWNLOAD - columns misplaced in excel

    1.As per my requirement the user want the report to displayed in excel without displaying on the screen.So the user enters the path where they want this report to be downloaded in the select option screen. 2.We are using the function module GUI_DOWNL

  • PLEASE add the ability to rename layers in Muse!

    Adobe, please allow us to rename ANY layer in Muse so we can know what each layer is. This is a very basic feature of nearly every Adobe software available and should be included in Muse ASAP. It is so difficult to find objects when the majority of t

  • Log file in Batch job

    Hi All Do we get a log file in Batch job...??? I mean to say when we schedule a job in SM36 and after the job is run.. do we have a log file to have alook at it??? what does log file contain???? I am actually downloading a file in Application server.

  • Broken Web Part Issue

    Hi.. We Restored Content Database backup from SharePoint 2010 to SharePoint 2013 environment and its restored correctly, but when we browsed the site, we are getting  Could not load file or assembly  or one of its dependencies. The system cannot find