This discussion is archived
1 Reply Latest reply: Aug 14, 2012 8:17 AM by 955733 RSS

Failed to find policy referenced by URI

SeBO Newbie
Currently Being Moderated
Hi

I wrote simple webservice with mtom enabled and now I'm trying to test it from standalone client but after every test I get (on client side):
Jul 09, 2012 11:57:06 AM [com.sun.xml.ws.policy.jaxws.BuilderHandler] getPolicySubjects
SEVERE: WSP1005: Failed to find policy referenced by URI "http://172.16.122.76:7019/ws/file/PlikService?WSDL#mtom_wsp12".
Jul 09, 2012 11:57:06 AM [com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension] postFinished
SEVERE: WSP1005: Failed to find policy referenced by URI "http://172.16.122.76:7019/ws/file/PlikService?WSDL#mtom_wsp12".
Jul 09, 2012 11:57:06 AM [com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension] postFinished
SEVERE: WSP1007: Policy exception occurred when finishing WSDL parsing.
com.sun.xml.ws.policy.PolicyException: WSP1005: Failed to find policy referenced by URI "http://172.16.122.76:7019/ws/file/PlikService?WSDL#mtom_wsp12".
     at com.sun.xml.ws.policy.jaxws.BuilderHandler.getPolicies(BuilderHandler.java:100)
     at com.sun.xml.ws.policy.jaxws.BuilderHandler.getPolicySubjects(BuilderHandler.java:110)
     at com.sun.xml.ws.policy.jaxws.BuilderHandlerEndpointScope.doPopulate(BuilderHandlerEndpointScope.java:72)
     at com.sun.xml.ws.policy.jaxws.BuilderHandler.populate(BuilderHandler.java:82)
     at com.sun.xml.ws.policy.jaxws.PolicyMapBuilder.getNewPolicyMap(PolicyMapBuilder.java:109)
     at com.sun.xml.ws.policy.jaxws.PolicyMapBuilder.getPolicyMap(PolicyMapBuilder.java:91)
     at com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension.postFinished(PolicyWSDLParserExtension.java:960)
     at com.sun.xml.ws.wsdl.parser.DelegatingParserExtension.postFinished(DelegatingParserExtension.java:191)
     at com.sun.xml.ws.wsdl.parser.WSDLParserExtensionFacade.postFinished(WSDLParserExtensionFacade.java:338)
     at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:234)
     at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:191)
     at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:160)
     at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:307)
     at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:269)
     at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:205)
     at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:195)
     at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:112)
     at javax.xml.ws.Service.<init>(Service.java:77)
     at pl.nbp.sis2.client.mtom.file.PlikService.<init>(PlikService.java:42)
     at pl.nbp.jaxws.Plik.makeTest(Plik.java:23)
     at pl.nbp.jaxws.Main.main(Main.java:13)

Exception in thread "main" javax.xml.ws.WebServiceException: WSP1007: Policy exception occurred when finishing WSDL parsing.
     at com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension.postFinished(PolicyWSDLParserExtension.java:966)
     at com.sun.xml.ws.wsdl.parser.DelegatingParserExtension.postFinished(DelegatingParserExtension.java:191)
     at com.sun.xml.ws.wsdl.parser.WSDLParserExtensionFacade.postFinished(WSDLParserExtensionFacade.java:338)
     at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:234)
     at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:191)
     at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:160)
     at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:307)
     at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:269)
     at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:205)
     at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:195)
     at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:112)
     at javax.xml.ws.Service.<init>(Service.java:77)
     at pl.nbp.sis2.client.mtom.file.PlikService.<init>(PlikService.java:42)
     at pl.nbp.jaxws.Plik.makeTest(Plik.java:23)
     at pl.nbp.jaxws.Main.main(Main.java:13)
Caused by: com.sun.xml.ws.policy.PolicyException: WSP1005: Failed to find policy referenced by URI "http://172.16.122.76:7019/ws/file/PlikService?WSDL#mtom_wsp12".
     at com.sun.xml.ws.policy.jaxws.BuilderHandler.getPolicies(BuilderHandler.java:100)
     at com.sun.xml.ws.policy.jaxws.BuilderHandler.getPolicySubjects(BuilderHandler.java:110)
     at com.sun.xml.ws.policy.jaxws.BuilderHandlerEndpointScope.doPopulate(BuilderHandlerEndpointScope.java:72)
     at com.sun.xml.ws.policy.jaxws.BuilderHandler.populate(BuilderHandler.java:82)
     at com.sun.xml.ws.policy.jaxws.PolicyMapBuilder.getNewPolicyMap(PolicyMapBuilder.java:109)
     at com.sun.xml.ws.policy.jaxws.PolicyMapBuilder.getPolicyMap(PolicyMapBuilder.java:91)
     at com.sun.xml.ws.policy.jaxws.PolicyWSDLParserExtension.postFinished(PolicyWSDLParserExtension.java:960)
     ... 14 more

Service test works from soup-ui (I didn't check it from webclient deployed on WLS)

WSDL of that serwis is like follows:
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.6hudson-86 svn-revision#12773. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.6hudson-86 svn-revision#12773. -->
<definitions xmlns:wssutil="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy"
xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://jksjs.nbp.pl/WSDL/PlikService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://jksjs.nbp.pl/WSDL/PlikService"
name="PlikService">
<wsp:UsingPolicy wsu:Required="true"/>
<wsp1_2:Policy wsu:Id="mtom_wsp12">
<ns0:OptimizedMimeSerialization xmlns:ns0="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"/>
</wsp1_2:Policy>
<wsp:UsingPolicy wssutil:Required="true"/>
<wsp1_2:Policy wssutil:Id="mtom_wsp12">
<ns1:OptimizedMimeSerialization xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"/>
</wsp1_2:Policy>
<types>
<xsd:schema>
<xsd:import namespace="http://jksjs.nbp.pl/schema/zis/typyDanych" schemaLocation="http://172.16.122.76:7019/ws/file/PlikService?xsd=1"/>
</xsd:schema>
</types>
<message name="PobierzPlik">
<part xmlns:ns2="http://jksjs.nbp.pl/schema/zis/typyDanych" name="params" element="ns2:plikRequest"/>
</message>
<message name="PobierzPlikResponse">
<part xmlns:ns3="http://jksjs.nbp.pl/schema/zis/typyDanych" name="output" element="ns3:plikResponse"/>
</message>
<message name="ErrorMsg">
<part xmlns:ns4="http://jksjs.nbp.pl/schema/zis/typyDanych" name="fault" element="ns4:errorMsg"/>
</message>
<portType name="PlikPortType">
<operation name="PobierzPlik">
<input wsam:Action="PobierzPlik" message="tns:PobierzPlik"/>
<output wsam:Action="http://jksjs.nbp.pl/WSDL/PlikService/PlikPortType/PobierzPlikResponse" message="tns:PobierzPlikResponse"/>
<fault message="tns:ErrorMsg" name="ErrorMsg" wsam:Action="http://jksjs.nbp.pl/WSDL/PlikService/PlikPortType/PobierzPlik/Fault/ErrorMsg"/>
</operation>
</portType>
<binding name="PlikPortBinding" type="tns:PlikPortType"><wsp:PolicyReference URI="#mtom_wsp12"/>
<wsp:PolicyReference URI="#mtom_wsp12"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="PobierzPlik">
<soap:operation soapAction="PobierzPlik"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="ErrorMsg">
<soap:fault name="ErrorMsg" use="literal"/>
</fault>
</operation>
</binding>
<service name="PlikService">
<port name="PlikPort" binding="tns:PlikPortBinding">
<soap:address location="http://172.16.122.76:7019/ws/file/PlikService"/>
</port>
</service>
</definitions>

What can be wrong ?
I use wsimport to generate WS artifacts for client (from jdk 1.7) .
  • 1. Re: Failed to find policy referenced by URI
    955733 Newbie
    Currently Being Moderated
    Seems I have the exact same error quite often when trying to access partner webservices. I do not have a solution yet and I've tried a lot of experiments, research and analysis. Some of those issues have been quite some time ago but right now I have another case like that.

    So far I'm fairly certain that the WSDL which causes these mistakes is correctly structured, URI is properly defined and also referenced.

    The issue appeared for the first time when I switched my projects from Java6 to Java7. There must be some internal component at a new version which uses a lot more validation and is extremely strict. (I have that assumption because some time ago I also had to tackle problems with slightly incorrect WSDLs which did not cause a problem with Java6, but threw real Exceptions with Java7...) Too bad that I cannot recall what components I tried to examine (code, issue trackers) but I think I looked around for suspicious information about strange Policy behaviour and scanned quite a lot of the WSIT and JAX-WS resources.

    Do you already have new information to narrow down the possible sources of that annoying behaviour?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points