Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #27949 > unrolled thread

Parsing Soap Response in java

Started byemmna.90@gmail.com
First post2014-04-04 03:07 -0700
Last post2014-04-12 09:56 +0100
Articles 12 — 7 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Parsing Soap Response in java emmna.90@gmail.com - 2014-04-04 03:07 -0700
    Re: Parsing Soap Response in java Jeff Higgins <jeff@invalid.invalid> - 2014-04-04 15:20 -0400
    Re: Parsing Soap Response in java Roedy Green <see_website@mindprod.com.invalid> - 2014-04-04 15:28 -0700
    Re: Parsing Soap Response in java Arne Vajhøj <arne@vajhoej.dk> - 2014-04-04 22:50 -0400
      Re: Parsing Soap Response in java Emna Sabri <emmna.90@gmail.com> - 2014-04-11 04:32 -0700
        Re: Parsing Soap Response in java Arne Vajhøj <arne@vajhoej.dk> - 2014-04-11 21:03 -0400
    Re: Parsing Soap Response in java Silvio <silvio@internet.com> - 2014-04-11 13:49 +0200
      Re: Parsing Soap Response in java Emna Sabri <emmna.90@gmail.com> - 2014-04-11 05:31 -0700
        Re: Parsing Soap Response in java Silvio <silvio@internet.com> - 2014-04-11 18:05 +0200
        Re: Parsing Soap Response in java Arne Vajhøj <arne@vajhoej.dk> - 2014-04-11 21:05 -0400
          Re: Parsing Soap Response in java Emna Sabri <emmna.90@gmail.com> - 2014-04-17 13:42 -0700
    Re: Parsing Soap Response in java lipska the kat <lipskathekat@example.com> - 2014-04-12 09:56 +0100

#27949 — Parsing Soap Response in java

Fromemmna.90@gmail.com
Date2014-04-04 03:07 -0700
SubjectParsing Soap Response in java
Message-ID<bd5fa8aa-5b67-4999-adb3-e45be51f3e11@googlegroups.com>
Hi,i need to parse a soap response from an xml fileb in java  to get some specific values of it .For example ,i need to have the value v1 of string parameter in operationname1 and v2 of string parameter of operationname2.i tried with some tuto in the net but it doesn't work for me  .I will be very thankful if you can help me .
Here is the soap response.xml.


<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="...">
<soapenv:Body>
<ns1:CommandResponseData xmlns:ns1="...">
         <ns1:CommandResult>
            <ns1:TransactionResult>
              <ns1:OperationResult>
              <ns1:Operation name="operationname1" modifier="modify1">
                     <ns1:ParameterList>
                      <ns1:StringParameter name="n1">v1</ns1:StringParameter>
                      <ns1:DateTimeParametername="d1">value</ns1:DateTimeParameter>                   
                </ns1:ParameterList>
		</ns1:Operation>

                  </ns1:Operation>
            <ns1:Operation name="operationname2" modifier="modify2">
                     <ns1:ParameterList>
     <ns1:StringParameter name="c1">v2</ns1:StringParameter>                      
                     </ns1:ParameterList>
		</ns1:Operation>
            </ns1:OperationResult>
        </ns1:TransactionResult>
    </ns1:CommandResult>
 </ns1:CommandResponseData>
   </soapenv:Body>
</soapenv:Envelope>

[toc] | [next] | [standalone]


#27955

FromJeff Higgins <jeff@invalid.invalid>
Date2014-04-04 15:20 -0400
Message-ID<lhn0qh$n13$1@dont-email.me>
In reply to#27949
On 04/04/2014 06:07 AM, emmna.90@gmail.com wrote:
some tuto in the net
<http://docs.oracle.com/javase/tutorial/jaxp/index.html>

[toc] | [prev] | [next] | [standalone]


#27956

FromRoedy Green <see_website@mindprod.com.invalid>
Date2014-04-04 15:28 -0700
Message-ID<66cuj9123dqe46h0hm2tovn0sbrk1ojosa@4ax.com>
In reply to#27949
On Fri, 4 Apr 2014 03:07:23 -0700 (PDT), emmna.90@gmail.com wrote,
quoted or indirectly quoted someone who said :

>Hi,i need to parse a soap response from an xml fileb in java  to get some s=
>pecific values of it .For example ,i need to have the value v1 of string pa=
>rameter in operationname1 and v2 of string parameter of operationname2.i tr=
>ied with some tuto in the net but it doesn't work for me  .I will be very t=
>hankful if you can help me .
>Here is the soap response.xml.

I parse the soap responses from Amazon that tells me which books they
have in stock.

You need a Jax-compatible descriptor of the soap records.  It then
generates you Java sourcecode to parse the incoming stream.

You then navigate the tree to pick out what you want.
 
see http://mindprod.com/jax.html

Amazon provides a descriptor file 
AWSECommerceService.wsdl

that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://webservices.amazon.com/AWSECommerceService/2011-08-01"
targetNamespace="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
    <types>
	<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://webservices.amazon.com/AWSECommerceService/2011-08-01"
targetNamespace="http://webservices.amazon.com/AWSECommerceService/2011-08-01"
elementFormDefault="qualified">
		<xs:element name="Bin">
			<xs:complexType>
				<xs:sequence>
...
-- 
Roedy Green Canadian Mind Products http://mindprod.com
"The question of whether machines can think is about as relevant 
as the question of whether submarines can swim"
~ Edsger Wybe Dijkstra (born: 1930-05-11 died: 2002-08-06 at age: 72)

[toc] | [prev] | [next] | [standalone]


#27957

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-04-04 22:50 -0400
Message-ID<533f6f84$0$307$14726298@news.sunsite.dk>
In reply to#27949
On 4/4/2014 6:07 AM, emmna.90@gmail.com wrote:
> Hi,i need to parse a soap response from an xml fileb in java to get
 > some specific values of it .For example ,i need to have the value v1 of
 > string parameter in operationname1 and v2 of string parameter of
 > operationname2.i tried with some tuto in the net but it doesn't work
 > for me.
 >
> Here is the soap response.xml.
>
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="...">
> <soapenv:Body>
> <ns1:CommandResponseData xmlns:ns1="...">
>           <ns1:CommandResult>
>              <ns1:TransactionResult>
>                <ns1:OperationResult>
>                <ns1:Operation name="operationname1" modifier="modify1">
>                       <ns1:ParameterList>
>                        <ns1:StringParameter name="n1">v1</ns1:StringParameter>
>                        <ns1:DateTimeParametername="d1">value</ns1:DateTimeParameter>
>                  </ns1:ParameterList>
> 		</ns1:Operation>
>
>                    </ns1:Operation>
>              <ns1:Operation name="operationname2" modifier="modify2">
>                       <ns1:ParameterList>
>       <ns1:StringParameter name="c1">v2</ns1:StringParameter>
>                       </ns1:ParameterList>
> 		</ns1:Operation>
>              </ns1:OperationResult>
>          </ns1:TransactionResult>
>      </ns1:CommandResult>
>   </ns1:CommandResponseData>
>     </soapenv:Body>
> </soapenv:Envelope>

0) That is not the SOAP result as it is not well formed XML.

I will assume it looks like:

<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="...">
     <soapenv:Body>
         <ns1:CommandResponseData xmlns:ns1="...">
             <ns1:CommandResult>
                 <ns1:TransactionResult>
                     <ns1:OperationResult>
                         <ns1:Operation name="operationname1" 
modifier="modify1">
                             <ns1:ParameterList>
                                 <ns1:StringParameter 
name="n1">v1</ns1:StringParameter>
                                 <ns1:DateTimeParameter 
name="d1">value</ns1:DateTimeParameter>
                             </ns1:ParameterList>
		                </ns1:Operation>
                         <ns1:Operation name="operationname2" 
modifier="modify2">
                             <ns1:ParameterList>
                                 <ns1:StringParameter 
name="c1">v2</ns1:StringParameter>
                             </ns1:ParameterList>
                         </ns1:Operation>
                     </ns1:OperationResult>
                </ns1:TransactionResult>
            </ns1:CommandResult>
        </ns1:CommandResponseData>
    </soapenv:Body>
</soapenv:Envelope>

1) If you are process XML when you are doing SOAP then you are most
    like doing it wrong. You should be generating stub code from the
    WSDL and just make a method call and not worry about XML at all.

2) If you really need to parse the response manually, then I will
    recommend using XPath.

Example reading the above XML from a disk file soap.xml:

import java.io.FileReader;
import java.io.IOException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class ManualSoapParse {
	public static void main(String[] args) throws 
ParserConfigurationException, SAXException, IOException, 
XPathExpressionException {
		 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
	     dbf.setNamespaceAware(false);
	     DocumentBuilder db = dbf.newDocumentBuilder();
	     Document doc = db.parse(new InputSource(new 
FileReader("/work/soap.xml")));
	     XPath xpath = XPathFactory.newInstance().newXPath();
	     Node n1 = 
(Node)xpath.evaluate("//Envelope/Body/CommandResponseData/CommandResult/TransactionResult/OperationResult/Operation[@name='operationname1']/ParameterList/StringParameter[@name='n1']/text()", 
doc.getDocumentElement(), XPathConstants.NODE);
	     System.out.println(n1.getNodeValue());
	     Node c1 = 
(Node)xpath.evaluate("//Envelope/Body/CommandResponseData/CommandResult/TransactionResult/OperationResult/Operation[@name='operationname2']/ParameterList/StringParameter[@name='c1']/text()", 
doc.getDocumentElement(), XPathConstants.NODE);
	     System.out.println(c1.getNodeValue());
	 }
}

Note that I cheated and ignored namespaces. You can handle namespaces if
you need to or want to.

Arne

[toc] | [prev] | [next] | [standalone]


#28026

FromEmna Sabri <emmna.90@gmail.com>
Date2014-04-11 04:32 -0700
Message-ID<37957ad3-d000-474b-a1ec-e154c52bc150@googlegroups.com>
In reply to#27957
Le samedi 5 avril 2014 03:50:42 UTC+1, Arne Vajhøj a écrit :
> On 4/4/2014 6:07 AM, emmna.90@gmail.com wrote:
> 
> > Hi,i need to parse a soap response from an xml fileb in java to get
> 
>  > some specific values of it .For example ,i need to have the value v1 of
> 
>  > string parameter in operationname1 and v2 of string parameter of
> 
>  > operationname2.i tried with some tuto in the net but it doesn't work
> 
>  > for me.
> 
>  >
> 
> > Here is the soap response.xml.
> 
> >
> 
> > <?xml version='1.0' encoding='utf-8'?>
> 
> > <soapenv:Envelope xmlns:soapenv="...">
> 
> > <soapenv:Body>
> 
> > <ns1:CommandResponseData xmlns:ns1="...">
> 
> >           <ns1:CommandResult>
> 
> >              <ns1:TransactionResult>
> 
> >                <ns1:OperationResult>
> 
> >                <ns1:Operation name="operationname1" modifier="modify1">
> 
> >                       <ns1:ParameterList>
> 
> >                        <ns1:StringParameter name="n1">v1</ns1:StringParameter>
> 
> >                        <ns1:DateTimeParametername="d1">value</ns1:DateTimeParameter>
> 
> >                  </ns1:ParameterList>
> 
> > 		</ns1:Operation>
> 
> >
> 
> >                    </ns1:Operation>
> 
> >              <ns1:Operation name="operationname2" modifier="modify2">
> 
> >                       <ns1:ParameterList>
> 
> >       <ns1:StringParameter name="c1">v2</ns1:StringParameter>
> 
> >                       </ns1:ParameterList>
> 
> > 		</ns1:Operation>
> 
> >              </ns1:OperationResult>
> 
> >          </ns1:TransactionResult>
> 
> >      </ns1:CommandResult>
> 
> >   </ns1:CommandResponseData>
> 
> >     </soapenv:Body>
> 
> > </soapenv:Envelope>
> 
> 
> 
> 0) That is not the SOAP result as it is not well formed XML.
> 
> 
> 
> I will assume it looks like:
> 
> 
> 
> <?xml version='1.0' encoding='utf-8'?>
> 
> <soapenv:Envelope xmlns:soapenv="...">
> 
>      <soapenv:Body>
> 
>          <ns1:CommandResponseData xmlns:ns1="...">
> 
>              <ns1:CommandResult>
> 
>                  <ns1:TransactionResult>
> 
>                      <ns1:OperationResult>
> 
>                          <ns1:Operation name="operationname1" 
> 
> modifier="modify1">
> 
>                              <ns1:ParameterList>
> 
>                                  <ns1:StringParameter 
> 
> name="n1">v1</ns1:StringParameter>
> 
>                                  <ns1:DateTimeParameter 
> 
> name="d1">value</ns1:DateTimeParameter>
> 
>                              </ns1:ParameterList>
> 
> 		                </ns1:Operation>
> 
>                          <ns1:Operation name="operationname2" 
> 
> modifier="modify2">
> 
>                              <ns1:ParameterList>
> 
>                                  <ns1:StringParameter 
> 
> name="c1">v2</ns1:StringParameter>
> 
>                              </ns1:ParameterList>
> 
>                          </ns1:Operation>
> 
>                      </ns1:OperationResult>
> 
>                 </ns1:TransactionResult>
> 
>             </ns1:CommandResult>
> 
>         </ns1:CommandResponseData>
> 
>     </soapenv:Body>
> 
> </soapenv:Envelope>
> 
> 
> 
> 1) If you are process XML when you are doing SOAP then you are most
> 
>     like doing it wrong. You should be generating stub code from the
> 
>     WSDL and just make a method call and not worry about XML at all.
> 
> 
> 
> 2) If you really need to parse the response manually, then I will
> 
>     recommend using XPath.
> 
> 
> 
> Example reading the above XML from a disk file soap.xml:
> 
> 
> 
> import java.io.FileReader;
> 
> import java.io.IOException;
> 
> 
> 
> import javax.xml.parsers.DocumentBuilder;
> 
> import javax.xml.parsers.DocumentBuilderFactory;
> 
> import javax.xml.parsers.ParserConfigurationException;
> 
> import javax.xml.xpath.XPath;
> 
> import javax.xml.xpath.XPathConstants;
> 
> import javax.xml.xpath.XPathExpressionException;
> 
> import javax.xml.xpath.XPathFactory;
> 
> 
> 
> import org.w3c.dom.Document;
> 
> import org.w3c.dom.Node;
> 
> import org.xml.sax.InputSource;
> 
> import org.xml.sax.SAXException;
> 
> 
> 
> public class ManualSoapParse {
> 
> 	public static void main(String[] args) throws 
> 
> ParserConfigurationException, SAXException, IOException, 
> 
> XPathExpressionException {
> 
> 		 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
> 
> 	     dbf.setNamespaceAware(false);
> 
> 	     DocumentBuilder db = dbf.newDocumentBuilder();
> 
> 	     Document doc = db.parse(new InputSource(new 
> 
> FileReader("/work/soap.xml")));
> 
> 	     XPath xpath = XPathFactory.newInstance().newXPath();
> 
> 	     Node n1 = 
> 
> (Node)xpath.evaluate("//Envelope/Body/CommandResponseData/CommandResult/TransactionResult/OperationResult/Operation[@name='operationname1']/ParameterList/StringParameter[@name='n1']/text()", 
> 
> doc.getDocumentElement(), XPathConstants.NODE);
> 
> 	     System.out.println(n1.getNodeValue());
> 
> 	     Node c1 = 
> 
> (Node)xpath.evaluate("//Envelope/Body/CommandResponseData/CommandResult/TransactionResult/OperationResult/Operation[@name='operationname2']/ParameterList/StringParameter[@name='c1']/text()", 
> 
> doc.getDocumentElement(), XPathConstants.NODE);
> 
> 	     System.out.println(c1.getNodeValue());
> 
> 	 }
> 
> }
> 
> 
> 
> Note that I cheated and ignored namespaces. You can handle namespaces if
> 
> you need to or want to.
> 
> 
> 
> Arne

hi Arne ,thank you for your response ,i used the 2nd issue to manually parse the soap response and it gives me errors in this line (System.out.println(n1.getNodeValue());) 
I have even added the namespace context by adding this code       NamespaceContext ctx = new NamespaceContext() {

            public String getNamespaceURI(String prefix) {
                String uri;
                if (prefix.equals("ns1")) {
                    uri = "uri of ns1";
                } else {
                    uri = null;
                }
                return uri;
            }

            public String getPrefix(String namespaceURI) {
                throw new UnsupportedOperationException("Not supported yet.");
            }

            public Iterator getPrefixes(String namespaceURI) {
                throw new UnsupportedOperationException("Not supported yet.");
            }
        };
and still haven't succeed to get the values .
Thanks in advance for your help .

[toc] | [prev] | [next] | [standalone]


#28037

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-04-11 21:03 -0400
Message-ID<534890e9$0$296$14726298@news.sunsite.dk>
In reply to#28026
On 4/11/2014 7:32 AM, Emna Sabri wrote:
> i used the 2nd issue to manually parse the soap response and it gives me errors in this line (System.out.println(n1.getNodeValue());)

Do you expect us to be able to guess what the problem is without you 
telling us what "gives me errors" covers?

Arne

[toc] | [prev] | [next] | [standalone]


#28027

FromSilvio <silvio@internet.com>
Date2014-04-11 13:49 +0200
Message-ID<5347d6e2$0$2835$e4fe514c@news.xs4all.nl>
In reply to#27949
On 04/04/2014 12:07 PM, emmna.90@gmail.com wrote:
> Hi,i need to parse a soap response from an xml fileb in java  to get some specific values of it .For example ,i need to have the value v1 of string parameter in operationname1 and v2 of string parameter of operationname2.i tried with some tuto in the net but it doesn't work for me  .I will be very thankful if you can help me .
> Here is the soap response.xml.
>
>
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="...">
> <soapenv:Body>
> <ns1:CommandResponseData xmlns:ns1="...">
>           <ns1:CommandResult>
>              <ns1:TransactionResult>
>                <ns1:OperationResult>
>                <ns1:Operation name="operationname1" modifier="modify1">
>                       <ns1:ParameterList>
>                        <ns1:StringParameter name="n1">v1</ns1:StringParameter>
>                        <ns1:DateTimeParametername="d1">value</ns1:DateTimeParameter>
>                  </ns1:ParameterList>
> 		</ns1:Operation>
>
>                    </ns1:Operation>
>              <ns1:Operation name="operationname2" modifier="modify2">
>                       <ns1:ParameterList>
>       <ns1:StringParameter name="c1">v2</ns1:StringParameter>
>                       </ns1:ParameterList>
> 		</ns1:Operation>
>              </ns1:OperationResult>
>          </ns1:TransactionResult>
>      </ns1:CommandResult>
>   </ns1:CommandResponseData>
>     </soapenv:Body>
> </soapenv:Envelope>
>


What you want would be ease to do with DOM plus maybe some XPath if the 
XML where valid, which it is not.

Silvio

[toc] | [prev] | [next] | [standalone]


#28028

FromEmna Sabri <emmna.90@gmail.com>
Date2014-04-11 05:31 -0700
Message-ID<1aed13b9-6815-4e62-8b24-3e16a486b608@googlegroups.com>
In reply to#28027
Le vendredi 11 avril 2014 12:49:54 UTC+1, Silvio a écrit :
> On 04/04/2014 12:07 PM, emmna.90@gmail.com wrote:
> 
> > Hi,i need to parse a soap response from an xml fileb in java  to get some specific values of it .For example ,i need to have the value v1 of string parameter in operationname1 and v2 of string parameter of operationname2.i tried with some tuto in the net but it doesn't work for me  .I will be very thankful if you can help me .
> 
> > Here is the soap response.xml.
> 
> >
> 
> >
> 
> > <?xml version='1.0' encoding='utf-8'?>
> 
> > <soapenv:Envelope xmlns:soapenv="...">
> 
> > <soapenv:Body>
> 
> > <ns1:CommandResponseData xmlns:ns1="...">
> 
> >           <ns1:CommandResult>
> 
> >              <ns1:TransactionResult>
> 
> >                <ns1:OperationResult>
> 
> >                <ns1:Operation name="operationname1" modifier="modify1">
> 
> >                       <ns1:ParameterList>
> 
> >                        <ns1:StringParameter name="n1">v1</ns1:StringParameter>
> 
> >                        <ns1:DateTimeParametername="d1">value</ns1:DateTimeParameter>
> 
> >                  </ns1:ParameterList>
> 
> > 		</ns1:Operation>
> 
> >
> 
> >                    </ns1:Operation>
> 
> >              <ns1:Operation name="operationname2" modifier="modify2">
> 
> >                       <ns1:ParameterList>
> 
> >       <ns1:StringParameter name="c1">v2</ns1:StringParameter>
> 
> >                       </ns1:ParameterList>
> 
> > 		</ns1:Operation>
> 
> >              </ns1:OperationResult>
> 
> >          </ns1:TransactionResult>
> 
> >      </ns1:CommandResult>
> 
> >   </ns1:CommandResponseData>
> 
> >     </soapenv:Body>
> 
> > </soapenv:Envelope>
> 
> >
> 
> 
> 
> 
> 
> What you want would be ease to do with DOM plus maybe some XPath if the 
> 
> XML where valid, which it is not.
> 
> 
> 
> Silvio

Sorry but how can i parse the soap response if it isn't with xml parsing ?

[toc] | [prev] | [next] | [standalone]


#28030

FromSilvio <silvio@internet.com>
Date2014-04-11 18:05 +0200
Message-ID<534812e7$0$2848$e4fe514c@news2.news.xs4all.nl>
In reply to#28028
On 04/11/2014 02:31 PM, Emna Sabri wrote:
> Le vendredi 11 avril 2014 12:49:54 UTC+1, Silvio a écrit :
>> On 04/04/2014 12:07 PM, emmna.90@gmail.com wrote:
>>
>>> Hi,i need to parse a soap response from an xml fileb in java  to get some specific values of it .For example ,i need to have the value v1 of string parameter in operationname1 and v2 of string parameter of operationname2.i tried with some tuto in the net but it doesn't work for me  .I will be very thankful if you can help me .
>>
>>> Here is the soap response.xml.
>>
>>>
>>
>>>
>>
>>> <?xml version='1.0' encoding='utf-8'?>
>>
>>> <soapenv:Envelope xmlns:soapenv="...">
>>
>>> <soapenv:Body>
>>
>>> <ns1:CommandResponseData xmlns:ns1="...">
>>
>>>            <ns1:CommandResult>
>>
>>>               <ns1:TransactionResult>
>>
>>>                 <ns1:OperationResult>
>>
>>>                 <ns1:Operation name="operationname1" modifier="modify1">
>>
>>>                        <ns1:ParameterList>
>>
>>>                         <ns1:StringParameter name="n1">v1</ns1:StringParameter>
>>
>>>                         <ns1:DateTimeParametername="d1">value</ns1:DateTimeParameter>
>>
>>>                   </ns1:ParameterList>
>>
>>> 		</ns1:Operation>
>>
>>>
>>
>>>                     </ns1:Operation>
>>
>>>               <ns1:Operation name="operationname2" modifier="modify2">
>>
>>>                        <ns1:ParameterList>
>>
>>>        <ns1:StringParameter name="c1">v2</ns1:StringParameter>
>>
>>>                        </ns1:ParameterList>
>>
>>> 		</ns1:Operation>
>>
>>>               </ns1:OperationResult>
>>
>>>           </ns1:TransactionResult>
>>
>>>       </ns1:CommandResult>
>>
>>>    </ns1:CommandResponseData>
>>
>>>      </soapenv:Body>
>>
>>> </soapenv:Envelope>
>>
>>>
>>
>>
>>
>>
>>
>> What you want would be ease to do with DOM plus maybe some XPath if the
>>
>> XML where valid, which it is not.
>>
>>
>>
>> Silvio
>
> Sorry but how can i parse the soap response if it isn't with xml parsing ?
>

It would be with XML parsing IF it where actual XML. What you have 
provided is not valid XML and can therefore not be parsed with an XML 
parser. Are you sure you posted an actual sample of what you are trying 
to parse?

[toc] | [prev] | [next] | [standalone]


#28038

FromArne Vajhøj <arne@vajhoej.dk>
Date2014-04-11 21:05 -0400
Message-ID<53489154$0$296$14726298@news.sunsite.dk>
In reply to#28028
On 4/11/2014 8:31 AM, Emna Sabri wrote:
> Sorry but how can i parse the soap response if it isn't with xml parsing ?

If you have a strong desire for some unmaintainable code, then there are
lots of possibilities in String indexOf and String substring.

Arne

[toc] | [prev] | [next] | [standalone]


#28120

FromEmna Sabri <emmna.90@gmail.com>
Date2014-04-17 13:42 -0700
Message-ID<ecd3adb6-c54e-4316-aea7-7b2d106478f5@googlegroups.com>
In reply to#28038
Le samedi 12 avril 2014 03:05:24 UTC+2, Arne Vajhøj a écrit :
> On 4/11/2014 8:31 AM, Emna Sabri wrote:
> 
> > Sorry but how can i parse the soap response if it isn't with xml parsing ?
> 
> 
> 
> If you have a strong desire for some unmaintainable code, then there are
> 
> lots of possibilities in String indexOf and String substring.
> 
> 
> 
> Arne

Hi ,i solved the problem :) your response helps me a lot ,in fact the fault was when copying values .Thanks

[toc] | [prev] | [next] | [standalone]


#28040

Fromlipska the kat <lipskathekat@example.com>
Date2014-04-12 09:56 +0100
Message-ID<DtCdnWNnec1FYtXOnZ2dnUVZ8gednZ2d@bt.com>
In reply to#27949
On 04/04/14 11:07, emmna.90@gmail.com wrote:

There are two problems with this XML
Try fixing them and then parse again.

> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="...">
> <soapenv:Body>
> <ns1:CommandResponseData xmlns:ns1="...">
>           <ns1:CommandResult>
>              <ns1:TransactionResult>
>                <ns1:OperationResult>
>                <ns1:Operation name="operationname1" modifier="modify1">
>                       <ns1:ParameterList>
>                        <ns1:StringParameter name="n1">v1</ns1:StringParameter>
----------> problem -----> 
<ns1:DateTimeParametername="d1">value</ns1:DateTimeParameter> 

>                  </ns1:ParameterList>
> 		</ns1:Operation>
>
----------> problem ------> </ns1:Operation>
>              <ns1:Operation name="operationname2" modifier="modify2">
>                       <ns1:ParameterList>
>       <ns1:StringParameter name="c1">v2</ns1:StringParameter>
>                       </ns1:ParameterList>
> 		</ns1:Operation>
>              </ns1:OperationResult>
>          </ns1:TransactionResult>
>      </ns1:CommandResult>
>   </ns1:CommandResponseData>
>     </soapenv:Body>
> </soapenv:Envelope>


-- 
lipska the kat - treacherous feline.
Proudly nominated for IPOTY 2014 - LIGAF
GNU/Linux user #560883 - linuxcounter.net

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web