Announcement Announcement Module
Collapse
No announcement yet.
Problem with XPathExtension Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with XPathExtension

    Hi,

    I tried to use XPathExtension like described on I21's blog, but I have problem with mapping endpoint to requests.
    I have an endpoint (changeUserPasswordXPathEndpoint) and XPathEpression (changeUserPasswordXPathEndpoint) similar to those already mentioned and tried with PayloadRootQNameEndpointMapping:
    Code:
        <bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
            <property name="mappings">
                <props>
                    <prop key="{http://www.myname.org/schemas}ChangeUserPasswordRequest">changeUserPasswordXPathEndpoint</prop>
                </props>
            </property>
            <property name="interceptors">
                <bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
            </property>
        </bean>
    
        <bean id="changeUserPasswordExpression" class="org.springframework.xml.xpath.XPathExpressionFactoryBean">
            <property name="namespaces" value="http://www.myname.org/schemas"/>
            <property name="expression" value="/ChangeUserPasswordRequest/Username"/>
        </bean>
    
        <bean id="changeUserPasswordXPathEndpoint" class="org.myname.proj.webservice.ChangeUserPasswordXPathEndpoint">
            <constructor-arg ref="changeUserPasswordExpression"/>
        </bean>
    xsd looks like:
    Code:
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://www.myname.org/schemas"
            xmlns:ss="http://www.myname.org/schemas">
        <xs:element name="ChangeUserPasswordRequest">
            <xs:complexType>
                <xs:all>
                    <xs:element name="Username" type="xsd:string"/>
                    <xs:element name="OldPassword" type="xsd:string"/>
                    <xs:element name="NewPassword" type="xsd:string"/>
                </xs:all>
            </xs:complexType>
        </xs:element>
    </xs:schema>
    On incoming request Endpoint is called, but given element is null.
    I'm just stating with spring-ws, so maybe it's a trivial question, but how can I map XPathEndpoint to that request?

    Regards
    Marcin

  • #2
    I think the trick is that you don't define the namespaces in the XPathExpression properly. Try:

    Code:
    <bean id="changeUserPasswordExpression" class="org.springframework.xml.xpath.XPathExpressionFactoryBean">
      <property name="namespaces">
        <props>
          <prop key="tns">http://www.myname.org/schemas</prop>
        </props>
      <property name="expression" value="/tns:ChangeUserPasswordRequest/tns:Username"/>
    </bean>

    Comment


    • #3
      Yup. It was a problem. I treated "Namespaces" (Properties type) as a "Namespace" (String value).

      Thanks for a solution.

      Comment

      Working...
      X