4

I could send a request and receive the response but I can not parse the response. It returns the following error:

Local Name:Body
error is here
java.lang.NullPointerException
    at com.ticketmaster.ticketmaster.TicketMaster.Search(TicketMaster.java:119)
    at com.ticketmaster.ticketmaster.App.main(App.java:12)

Code

    SOAPMessage response
            = connection.call(message, endpoint);

    connection.close();
        SOAPMessage sm = response;
        SOAPBody sb = response.getSOAPBody();
        System.err.println("Node Name:" + sb.getNodeName());  //return nothing
        System.err.println("Local Name:" + sb.getLocalName());  //return Local Name:Body

        DOMSource source = new DOMSource(sb);
        results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class);
        System.err.println("Results size: " + this.results.returnTag.results.item.get(0).getName());

} catch (Exception ex) {
    System.err.println("error is here");
    ex.printStackTrace();
}

Response:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
                   xmlns:ns1="http://ticketmaster.productserve.com/v2/soap.php" 
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
                   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <ns1:findEventsResponse>
            <return xsi:type="ns1:Response">
                <details xsi:type="ns1:Details">
                    <totalResults xsi:type="xsd:int">20662</totalResults>
                    <totalPages xsi:type="xsd:int">414</totalPages>
                    <currentPage xsi:type="xsd:int">1</currentPage>
                    <resultsPerPage xsi:type="xsd:int">50</resultsPerPage>
                </details>
                <results SOAP-ENC:arrayType="ns1:Event[50]" xsi:type="ns1:ArrayOfEvent">
                    <item xsi:type="ns1:Event">
                        <eventId xsi:type="xsd:int">1516682</eventId>
                        <ticketmasterEventId xsi:type="xsd:string">18004C6E8D7218A8</ticketmasterEventId>
                        <status xsi:type="xsd:string">onSale</status>
                        <name xsi:type="xsd:string">The Art of the Brick</name>
                        <url xsi:type="xsd:string">http://www.ticketmaster.ie/event/18004C6E8D7218A8?camefrom=CFC_UK_BUYAT&amp;brand=[=BRAND=]</url>
                        <eventDate xsi:type="xsd:string">2014-05-23 10:00:00</eventDate>
                        <onSaleDate xsi:type="xsd:string">0000-00-00 00:00:00</onSaleDate>
                        <preSaleDate xsi:type="xsd:string">0000-00-00 00:00:00</preSaleDate>
                        <category xsi:type="xsd:string">Exhibitions</category>
                        <categoryId xsi:type="xsd:int">754</categoryId>
                        <parentCategory xsi:type="xsd:string">Family &amp;amp; Attractions</parentCategory>
                        <parentCategoryId xsi:type="xsd:int">10003</parentCategoryId>
                        <minPrice xsi:type="xsd:float">17</minPrice>
                        <maxPrice xsi:type="xsd:float">17</maxPrice>
                        <artists SOAP-ENC:arrayType="ns1:Artist[1]" xsi:type="ns1:ArrayOfArtist">
                            <item xsi:type="ns1:Artist">
                                <artistId xsi:type="xsd:int">1806028</artistId>
                                <ticketmasterArtistId xsi:type="xsd:int">1663495</ticketmasterArtistId>
                                <name xsi:type="xsd:string">The Art of the Brick</name>
                                <url xsi:type="xsd:string">http://www.ticketmaster.co.uk/The-Art-of-the-Brick-tickets/artist/1663495?camefrom=CFC_UK_BUYAT&amp;brand=[=BRAND=]</url>
                                <imageUrl xsi:type="xsd:string">http://media.ticketmaster.com/tm/en-us/tmimages/TM_GenCatImgs_Generic_BW.jpg</imageUrl>
                                <category xsi:type="xsd:string">Miscellaneous</category>
                                <categoryId xsi:type="xsd:int">0</categoryId>
                                <parentCategory xsi:type="xsd:string">Miscellaneous</parentCategory>
                                <parentCategoryId xsi:type="xsd:int">10005</parentCategoryId>
                            </item>
                        </artists>
                        <venue xsi:type="ns1:Venue">
                            <venueId xsi:type="xsd:int">3331</venueId>
                            <ticketmasterVenueId xsi:type="xsd:int">198292</ticketmasterVenueId>
                            <name xsi:type="xsd:string">Ambassador Theatre</name>
                            <street xsi:type="xsd:string">Oconnell Street</street>
                            <city xsi:type="xsd:string">Dublin</city>
                            <country xsi:type="xsd:string">United Kingdom</country>
                            <postcode xsi:type="xsd:string">Dublin 1</postcode>
                            <url xsi:type="xsd:string">http://www.ticketmaster.ie/Ambassador-Theatre-tickets-Dublin/venue/198292?camefrom=CFC_UK_BUYAT&amp;brand=</url>
                            <imageUrl xsi:type="xsd:string">http://media.ticketmaster.co.uk/tmimages/TM_GenVenueImg_BW.jpg</imageUrl>
                            <state xsi:type="xsd:string"></state>
                        </venue>
                    </item>
                    <item xsi:type="ns1:Event">
                     ....

Model Classes

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class FindEventsResponse {
    @XmlElement(name = "return")
    Return returnTag;

    public FindEventsResponse() {
       this.returnTag = new Return();
    }
    getter and setter

}

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Return {
    @XmlElement(name = "details")
    Details details;
    @XmlElement(name = "results")
    Results results;

    public Return(Details details, Results results) {
       this.details = new Details();
       this.results = new Results();
    }
    getters and setters


}

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Details {

    @XmlElement(name = "totalResults")
    int totalResults;
    @XmlElement(name = "totalPages")
    int totalPages;
    @XmlElement(name = "currentPage")
    int currentPage;
    @XmlElement(name = "resultPerPage")
    int resultsPerPage;

     getters and setters

}

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Results {
    @XmlElement(name = "item")
    List<Item> item;

    public Results() {
       this.item = new ArrayList();
    }
    getter and setter



}

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Item {

    @XmlElement(name = "eventId")
    int eventId;
    @XmlElement(name = "ticketmasterEventId")
    String ticketmasterEventId;
    @XmlElement(name = "status")
    String status;
    @XmlElement(name = "name")
    String name;
    @XmlElement(name = "url")
    String url;
    @XmlElement(name = "eventDate")
    String eventDate;
    @XmlElement(name = "onSaleDate")
    String onSaleDate;
    @XmlElement(name = "preSaleDate")
    String preSaleDate;
    @XmlElement(name = "category")
    String category;
    @XmlElement(name = "categoryId")
    int categoryId;
    @XmlElement(name = "parentCategory")
    String parentCategory;
    @XmlElement(name = "parentCategoryId")
    int parentCategoryId;
    @XmlElement(name = "minPrice")
    int minPrice;
    @XmlElement(name = "maxPrice")
    int maxPrice;
    @XmlElement(name = "artists")
    private Artists artist;
    @XmlElement(name = "venue")
    private Venue venue;

    public Item() {
       this.artist = new Artists();
       this.venue = new Venue();
    }

    getters and setters

}

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Artists {
    @XmlElement(name = "artists")
    private ArtistItem item;

    public Artists() {
        this.item = new ArtistItem();
    }
    getter and setter
}

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class ArtistItem {

    @XmlElement(name = "artistId")
    int artistId;
    @XmlElement(name = "ticketmasterArtistsId")
    int ticketmasterArtistId;
    @XmlElement(name = "name")
    String name;
    @XmlElement(name = "url")
    String url;
    @XmlElement(name = "imageUrl")
    String imageUrl;
    @XmlElement(name = "category")
    String category;
    @XmlElement(name = "categoryId")
    int categoryId;
    @XmlElement(name = "parentCategory")
    String parentCategory;
    @XmlElement(name = "parentCategoryId")
    int parentCategoryId;

    getters and setters
}

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Venue {

    @XmlElement(name = "venueId")
    int venueId;
    @XmlElement(name = "ticketmasterVenueId")
    int ticketmasterVenueId;
    @XmlElement(name = "name")
    String name;
    @XmlElement(name = "street")
    String street;
    @XmlElement(name = "city")
    String city;
    @XmlElement(name = "country")
    String country;
    @XmlElement(name = "postcode")
    String postcode;
    @XmlElement(name = "url")
    String url;
    @XmlElement(name = "imageUrl")
    String imageUrl;
    @XmlElement(name = "state")
    String state;

    getters and setters
}

Based on one of the following answers, I marshalled the result and it shows a wrong response.

package-info.java

@XmlSchema( 
    namespace = "http://ticketmaster.productserve.com/v2/soap.php",
    elementFormDefault = XmlNsForm.UNQUALIFIED) 
package com.ticketmaster.ticketmaster;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;

Code

    SOAPBody sb = response.getSOAPBody();
System.err.println(">>"+ sb.getFirstChild().getNodeName());
Iterator itr = sb.getChildElements();
while(itr.hasNext()){
    Object element = itr.next();
    System.err.println(element + " ");
}
Document d = sb.extractContentAsDocument();
System.err.println("result of d:"+d.getTextContent());
DOMSource source = new DOMSource(d);
results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class);
System.err.println("results>"+results.getReturnTag().getResults().getItem().get(0).getName());

Error is

.....
><city xsi:type="xsd:string">London</city><country xsi:type="xsd:string">United Kingdom</country><postcode xsi:type="xsd:string">SE1 8XX</postcode><url xsi:type="xsd:string">http://www.ticketmaster.co.uk/The-London-Wonderground-tickets-London/venue/253993?camefrom=CFC_UK_BUYAT&amp;brand=</url><imageUrl xsi:type="xsd:string">http://media.ticketmaster.co.uk/tmimages/TM_GenVenueImg_BW.jpg</imageUrl><state xsi:type="xsd:string"></state></venue></item></results></return></ns1:findEventsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>

>>ns1:findEventsResponse
[ns1:findEventsResponse: null] 
result of d:null
error is here

java.lang.IllegalArgumentException: prefix xsd is not bound to a namespace
    at com.sun.xml.internal.bind.DatatypeConverterImpl._parseQName(DatatypeConverterImpl.java:346)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader.selectLoader(LeafPropertyXsiLoader.java:75)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader.startElement(LeafPropertyXsiLoader.java:58)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:486)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(InterningXmlVisitor.java:60)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:135)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:229)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:266)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:235)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:112)
    at com.sun.xml.internal.bind.unmarshaller.DOMScanner.scan(DOMScanner.java:95)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:312)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:288)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:238)
    at javax.xml.bind.JAXB.unmarshal(JAXB.java:259)
    at com.ticketmaster.ticketmaster.TicketMaster.Search(TicketMaster.java:132)
    at com.ticketmaster.ticketmaster.App.main(App.java:12)   
Jack
  • 6,430
  • 27
  • 80
  • 151
J888
  • 1,944
  • 8
  • 42
  • 76
  • 1
    Please, post TicketMaster code, in particular line 128. – Giovanni Giachetti May 22 '14 at 12:34
  • 1
    @giorco question is updated, I also mentioned the line that is throwing the error. – J888 May 23 '14 at 10:46
  • Why you don't use some library to work with SOAP? [cxf](http://cxf.apache.org) for example. – user1516873 Jun 16 '14 at 15:14
  • @user1516873 is there any specific reason that you recommend cxf? I am not familiar with that. – Jack Jun 17 '14 at 06:35
  • @JackMoore no, not really, it is just one of many good open source library to work with web-services, with many features, with spring integration, and i personally use it last time to connect to service protected with ws-security. If you wish, you can look at Axis2 (last release in 2012) or Glassfish Metro. – user1516873 Jun 17 '14 at 07:48

1 Answers1

16

Ensure You Are Unmarshalling the Correct Thing

You need to unmarshal the content held onto by SOAP body, not the entire SOAP message. Below is what the code might look like:

SOAPMessage sm = response;
SOAPBody sb = response.getSOAPBody();
Document d = sb.extractContentAsDocument();
DOMSource source = new DOMSource(d);
results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class);

The result of sb.extractContentAsDocument is going to be a DOM that is equivalent to the following:

<?xml version="1.0" encoding="UTF-8"?>
<ns1:findEventsResponse xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:ns1="http://ticketmaster.productserve.com/v2/soap.php"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <return xsi:type="ns1:Response">
        <details xsi:type="ns1:Details">
            <totalResults xsi:type="xsd:int">20662</totalResults>
            <totalPages xsi:type="xsd:int">414</totalPages>
            <currentPage xsi:type="xsd:int">1</currentPage>
            <resultsPerPage xsi:type="xsd:int">50</resultsPerPage>
        </details>
        <results SOAP-ENC:arrayType="ns1:Event[50]" xsi:type="ns1:ArrayOfEvent">
            <item xsi:type="ns1:Event">
                <eventId xsi:type="xsd:int">1516682</eventId>
                <ticketmasterEventId xsi:type="xsd:string">18004C6E8D7218A8</ticketmasterEventId>
                <status xsi:type="xsd:string">onSale</status>
                <name xsi:type="xsd:string">The Art of the Brick</name>
                <url xsi:type="xsd:string">http://www.ticketmaster.ie/event/18004C6E8D7218A8?camefrom=CFC_UK_BUYAT&amp;brand=[=BRAND=]</url>
                <eventDate xsi:type="xsd:string">2014-05-23 10:00:00</eventDate>
                <onSaleDate xsi:type="xsd:string">0000-00-00 00:00:00</onSaleDate>
                <preSaleDate xsi:type="xsd:string">0000-00-00 00:00:00</preSaleDate>
                <category xsi:type="xsd:string">Exhibitions</category>
                <categoryId xsi:type="xsd:int">754</categoryId>
                <parentCategory xsi:type="xsd:string">Family &amp;amp; Attractions</parentCategory>
                <parentCategoryId xsi:type="xsd:int">10003</parentCategoryId>
                <minPrice xsi:type="xsd:float">17</minPrice>
                <maxPrice xsi:type="xsd:float">17</maxPrice>
                <artists SOAP-ENC:arrayType="ns1:Artist[1]" xsi:type="ns1:ArrayOfArtist">
                    <item xsi:type="ns1:Artist">
                        <artistId xsi:type="xsd:int">1806028</artistId>
                        <ticketmasterArtistId xsi:type="xsd:int">1663495</ticketmasterArtistId>
                        <name xsi:type="xsd:string">The Art of the Brick</name>
                        <url xsi:type="xsd:string">http://www.ticketmaster.co.uk/The-Art-of-the-Brick-tickets/artist/1663495?camefrom=CFC_UK_BUYAT&amp;brand=[=BRAND=]</url>
                        <imageUrl xsi:type="xsd:string">http://media.ticketmaster.com/tm/en-us/tmimages/TM_GenCatImgs_Generic_BW.jpg</imageUrl>
                        <category xsi:type="xsd:string">Miscellaneous</category>
                        <categoryId xsi:type="xsd:int">0</categoryId>
                        <parentCategory xsi:type="xsd:string">Miscellaneous</parentCategory>
                        <parentCategoryId xsi:type="xsd:int">10005</parentCategoryId>
                    </item>
                </artists>
                <venue xsi:type="ns1:Venue">
                    <venueId xsi:type="xsd:int">3331</venueId>
                    <ticketmasterVenueId xsi:type="xsd:int">198292</ticketmasterVenueId>
                    <name xsi:type="xsd:string">Ambassador Theatre</name>
                    <street xsi:type="xsd:string">Oconnell Street</street>
                    <city xsi:type="xsd:string">Dublin</city>
                    <country xsi:type="xsd:string">United Kingdom</country>
                    <postcode xsi:type="xsd:string">Dublin 1</postcode>
                    <url xsi:type="xsd:string">http://www.ticketmaster.ie/Ambassador-Theatre-tickets-Dublin/venue/198292?camefrom=CFC_UK_BUYAT&amp;brand=</url>
                    <imageUrl xsi:type="xsd:string">http://media.ticketmaster.co.uk/tmimages/TM_GenVenueImg_BW.jpg</imageUrl>
                    <state xsi:type="xsd:string"></state>
                </venue>
            </item>
            <item xsi:type="ns1:Event"></item>
        </results>
    </return>
</ns1:findEventsResponse>

UPDATE

Based on the new exception you are getting:

java.lang.IllegalArgumentException: prefix xsd is not bound to a namespace
    at com.sun.xml.internal.bind.DatatypeConverterImpl._parseQName(DatatypeConverterImpl.java:346)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader.selectLoader(LeafPropertyXsiLoader.java:75)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader.startElement(LeafPropertyXsiLoader.java:58)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:486)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:465)

It appears as though sb.extractContentAsDocument(); is not bringing along the xmlns:xsd declaration from the SOAP message. Instead you can change the code to do the following:

SOAPMessage sm = response;
SOAPBody sb = response.getSOAPBody();
DOMSource source = new DOMSource(sb.getFirstChild());
results = (FindEventsResponse) JAXB.unmarshal(source, FindEventsResponse.class);

Ensure the Namespace Qualification is Mapped Correctly

Having the following tells JAXB that everything mapped to an XML element without an explicitly specified namespace should belong in the http://ticketmaster.productserve.com/v2/soap.php namespace.

@XmlSchema( 
    namespace = "http://ticketmaster.productserve.com/v2/soap.php",
    elementFormDefault = XmlNsForm.QUALIFIED) 
package com.ticketmaster.ticketmaster;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;

In your XML only the findEventsResponse element is namespace qualified. This means your annotation should be the following instead (note change from QUALIFIED to UNQUALIFIED):

@XmlSchema( 
    namespace = "http://ticketmaster.productserve.com/v2/soap.php",
    elementFormDefault = XmlNsForm.UNQUALIFIED) 
package com.ticketmaster.ticketmaster;
import javax.xml.bind.annotation.XmlNsForm;
import javax.xml.bind.annotation.XmlSchema;

Demo Code

Using the above XML as input.xml I was able to unmarshal and marshal the model as you have defined it in your question with the @XmlSchema fix mentioned above.

import javax.xml.bind.*;
import javax.xml.transform.stream.StreamSource;

public class Demo {

    public static void main(String[] args) throws Exception {
        JAXBContext jc = JAXBContext.newInstance(FindEventsResponse.class);

        Unmarshaller unmarshaller = jc.createUnmarshaller();
        StreamSource xml = new StreamSource("src/forum23806625/input.xml");
        JAXBElement<FindEventsResponse> response = unmarshaller.unmarshal(xml, FindEventsResponse.class);

        Marshaller marshaller = jc.createMarshaller();
        marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
        marshaller.marshal(response, System.out);
    }

}
bdoughan
  • 147,609
  • 23
  • 300
  • 400
  • it is still showing the same error message, question is updated. – J888 May 23 '14 at 10:42
  • @J888 - What element name corresponds to the `SOAPBody` in your example? Also can you post the object model you are trying to unmarshal? – bdoughan May 23 '14 at 11:05
  • 1
    Sorry I do not get what you mean by element name corresponds to the SOAPBody? also what do you mean by the object model, is that the FindEventsResponse.class? – J888 May 23 '14 at 12:03
  • @J888 - What do you get when you call `getNodeName()` or `getLocalName()` on your instance of `SOAPBody`? Can you post `FindEventsResponse`? Also there are may objects accessed on the line throwing the `NullPointerException`. Can you determine which object is `null`? – bdoughan May 23 '14 at 13:21
  • 1
    @J888 - If you populate your object model and marshal it out, what does the resulting XML look like? Comparing that output to the input you are trying to unmarshal will be helpful. – bdoughan Jun 02 '14 at 19:53
  • buddy I could not find an answer, would you please have a look at the updated question. Thanks – J888 Jun 09 '14 at 22:51
  • 1
    @J888 - I have updated my answer with a lot of information that should help. – bdoughan Jun 10 '14 at 18:17
  • Thanks for the comments, I changed my code as you mentioned but it runs into java.lang.IllegalArgumentException: prefix xsd is not bound to a namespace , and when I change unqualified to qualified it does not return any error but the class of results is null. question is updated. – J888 Jun 12 '14 at 22:08
  • @J888 - Instead of `extractContentAsDocument` try calling `getFirstChild`. – bdoughan Jun 12 '14 at 22:40
  • 1
    firstChild node and value are name: ns1:findEventsResponse value: null – J888 Jun 12 '14 at 22:59
  • 1
    @J888 `getNodeValue()` on an element always returns `null`, see table in class comment for `Node`: http://docs.oracle.com/javase/6/docs/api/org/w3c/dom/Node.html#getNodeValue(). Instead you need to inspect the child nodes. – bdoughan Jun 12 '14 at 23:32
  • Thanks, it is weird as I am able to show whole message but cannot show the children of response. Question is updated. – J888 Jun 13 '14 at 10:21
  • @J888 - What remaining issues are you having? – bdoughan Jun 16 '14 at 13:36
  • @BlaiseDoughan I reckon the question is updated, the following error is thrown java.lang.IllegalArgumentException: prefix xsd is not bound to a namespace – Jack Jun 17 '14 at 06:52
  • @J888 - Are you still using `sb.extractContentAsDocument` what happens when you try calling `sb.getFirstChild` instead? – bdoughan Jun 17 '14 at 09:23
  • @BlaiseDoughan output of getFirstChild is [ns1:findEventsResponse: null] – J888 Jun 17 '14 at 11:03
  • @J888 - What happens when you try to unmarshal a `DOMSource` on that `Element`? – bdoughan Jun 17 '14 at 11:15
  • @BlaiseDoughan result of d.getTextContent() is null – J888 Jun 17 '14 at 11:22
  • @J888 - It won't have text content, but it will have child elements. Can you try unmarshalling it? – bdoughan Jun 17 '14 at 11:25
  • @BlaiseDoughan I included the code in the question, it throws following exception java.lang.IllegalArgumentException: prefix xsd is not bound to a namespace – J888 Jun 17 '14 at 11:53
  • @J888 - Your code is using `extractContentAsDocument` what happens when you replace that line with `getFirstChild`? – bdoughan Jun 17 '14 at 11:57
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/55765/discussion-between-j888-and-blaise-doughan). – J888 Jun 17 '14 at 12:17
  • @BlaiseDoughan well done, please have a look at my question as well, I have already awarded the bounty for this one :D http://stackoverflow.com/questions/24131822/parsed-soap-response-is-different-with-the-received-response – Jack Jun 17 '14 at 14:39
  • @JackMoore - Are you able to join this chat room: http://chat.stackoverflow.com/rooms/55765/discussion-between-j888-and-blaise-doughan – bdoughan Jun 17 '14 at 14:42