Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6762085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:16:18+00:00 2026-05-26T14:16:18+00:00

When trying to parse the method return type, method name, and parameters from the

  • 0

When trying to parse the method return type, method name, and parameters from the following WSDL (xml document), I get null each time I try to retrieve something from the DOM document:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://math" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://math" xmlns:intf="http://math" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
 <wsdl:types>
  <schema elementFormDefault="qualified" targetNamespace="http://math" xmlns="http://www.w3.org/2001/XMLSchema">
   <element name="addTwoInts">
    <complexType>
     <sequence>
      <element name="int1" type="xsd:int"/>
      <element name="int2" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
   <element name="addTwoIntsResponse">
    <complexType>
     <sequence>
      <element name="addTwoIntsReturn" type="xsd:int"/>
     </sequence>
    </complexType>
   </element>
   <element name="multiplyTwoFloats">
    <complexType>
     <sequence>
      <element name="float1" type="xsd:float"/>
      <element name="float2" type="xsd:float"/>
     </sequence>
    </complexType>
   </element>
   <element name="multiplyTwoFloatsResponse">
    <complexType>
     <sequence>
      <element name="multiplyTwoFloatsReturn" type="xsd:float"/>
     </sequence>
    </complexType>
   </element>
  </schema>
 </wsdl:types>

   <wsdl:message name="addTwoIntsResponse">

      <wsdl:part element="impl:addTwoIntsResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="addTwoIntsRequest">

      <wsdl:part element="impl:addTwoInts" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="multiplyTwoFloatsRequest">

      <wsdl:part element="impl:multiplyTwoFloats" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:message name="multiplyTwoFloatsResponse">

      <wsdl:part element="impl:multiplyTwoFloatsResponse" name="parameters">

      </wsdl:part>

   </wsdl:message>

   <wsdl:portType name="MathServices">

      <wsdl:operation name="addTwoInts">

         <wsdl:input message="impl:addTwoIntsRequest" name="addTwoIntsRequest">

       </wsdl:input>

         <wsdl:output message="impl:addTwoIntsResponse" name="addTwoIntsResponse">

       </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="multiplyTwoFloats">

         <wsdl:input message="impl:multiplyTwoFloatsRequest" name="multiplyTwoFloatsRequest">

       </wsdl:input>

         <wsdl:output message="impl:multiplyTwoFloatsResponse" name="multiplyTwoFloatsResponse">

       </wsdl:output>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="MathServicesSoapBinding" type="impl:MathServices">

      <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="addTwoInts">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="addTwoIntsRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="addTwoIntsResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="multiplyTwoFloats">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="multiplyTwoFloatsRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="multiplyTwoFloatsResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="MathServicesService">

      <wsdl:port binding="impl:MathServicesSoapBinding" name="MathServices">

         <wsdlsoap:address location="http://localhost:8080/WSDLServer"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>

Here’s what I’ve tried to do programmatically:

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

        try {
            DocumentBuilder db = dbf.newDocumentBuilder();

            //parse using builder to get DOM representation of the XML file
            Document doc = db.parse("MathServices.xml");

            Node firstChild = doc.getFirstChild();
            System.out.println(firstChild.getNodeValue());


        }catch(ParserConfigurationException pce) {
            pce.printStackTrace();
        }catch(SAXException se) {
            se.printStackTrace();
        }catch(IOException ioe) {
            ioe.printStackTrace();
        }

As I mentioned, firstNode.getNodeValue() is returning null. I also get null values when trying to get other things such as the root node, etc. What am I doing wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:16:19+00:00Added an answer on May 26, 2026 at 2:16 pm

    The node firstChild seems to be a valid object (unequal to zero), otherwise you would get a null pointer exception when calling firstChild.getNodeValue().

    If you want to access the node name, use “doc.getNodeName()” rather than “doc.getNodeValue()”. The latter one gives you the content of the tag (without any content of child tags) that is listed between opening and closing tag, but not the tagname or any attributes.
    Moreover as the root tag “wsdl:definition” (in the example file) defines child tags, there cannot be any text content for it at the same time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webmethod which is trying to construct xml data document and return
I am trying to write a generic Parse method that converts and returns a
Trying to parse an HTML document and extract some elements (any links to text
Trying to parse Maplines for an airport. Each airport can have X number of
Trying to parse some XML but apparently this is too much for a lazy
Trying to parse an SQL string and pull out the parameters. Ex: select *
I'm trying to parse objects to XML in Delphi, so I read about calling
I'm trying to get XPath to return an attribute value yet first search for
I'm trying to parse the json grabbed from here . Basically what I do
I trying to parse a string in an XML node by using an XPath

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.