Announcement Announcement Module
No announcement yet.
XPathParam is NaN Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • XPathParam is NaN

    I'm using Netbeans to test my WebService, and each time it sends the request, my endpoint receives NaNs for its XPathParams. I'm not sure if I'm not doing the XPathParam properly or what, but it seems pretty straight forward.

    Here's the SOAP request from Netbeans:
    <?xml version="1.0" ?>
       <S:Envelope xmlns:S="">
             <ns1:getCatalogPageRequest xmlns:ns1="">
    Here's my EndPoint:
        @PayloadRoot(localPart = GET_CATALOG_PAGE_REQUEST, namespace = NAMESPACE_URI)
        public Source getCatalogPageRequest(@XPathParam("//siteId") double siteId, 
                                            @XPathParam("//folderId") double folderId, 
                                            @XPathParam("//page") double page, 
                                            @XPathParam("//resultsPerPage") double resultsPerPage){
    I've tried "//ns1:siteId" and "//tns:siteId" (since my xsd has the namespace "xmlns:tns" defined), however, they all return NaN.

    Any ideas why I'd be getting NaN for all values of this request? Thanks!

  • #2
    Basically, you need to bind the prefix to the correct namespace in the XPathParamAnnotationMethodEndpointAdapter. The fact that you defined them in the schema does not help this adapter. The airline sample shows how.


    • #3
      Thanks for your response, Arjen.

      So just to clarify, are you saying that my @PayloadRoot annotation namespace needs to point to a url that has a "ns1" namespace defined that matches the SOAP request?


      @PayloadRoot(localPart = GET_CATALOG_PAGE_REQUEST, namespace = NAMESPACE_URI)

      "NAMESPACE_URI" needs to resolve to the URL of a schema that has a matching namespace defined:


      Is that correct, or am I not following...


      • #4
        Oh, I see what you're saying. So I tried adding it to the bean's definition, however, it still isn't resolving:

        <bean class="">
            <property name="namespaces">
                    <prop key="tns"></prop>
                    <prop key="ns1"></prop>


        • #5
          Ok, so I figured it out. I added the "ns1" namespace mapping to the bean defintition, and then used "//ns1:..." to reference the values in my classes (instead of just the node name).

          Is there any particular reason "ns1" is used? Is there a way for responses to use a particular namespace? I hadn't defined "ns1" anywhere previously, however, it's being used in both the request and response. The only namespaces I had previously defined were "ns" and "tns". My concern is that if I expose my web services externally, will I have to be concerned about web service clients using different namespaces, which won't resolve in my endpoint since it's hard-coded to "ns1:..."?


          • #6
            ns1 is a namespace prefix, and not a namespaces URI. The prefix name is not significant, only the namespace URI is. You could change ns1 to jigamadoob and (supposing you change the prefix in the expression) it would still work with clients using ns1.