php - Validation of Soap-XML against XSD does not work -
since lot of days try validate soap requst xml against xsd, no success:
this xml (generated php-soap-client):
<?xml version="1.0" encoding="utf-8"?> <env:envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://localhost/apitest" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding"> <env:body> <ns1:hello env:encodingstyle="http://www.w3.org/2003/05/soap-encoding"> <input xsi:type="ns1:hellorequest"> <name xsi:type="ns1:name">martinmartinmartinmartin</name> <car xsi:type="ns1:car">ford</car> </input> </ns1:hello> </env:body> </env:envelope>
and xsd:
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/xmlschema" targetnamespace="http://localhost/apitest" xmlns="http://localhost/apitest" elementformdefault="qualified"> <xsd:element name="hellorequest"> <xsd:complextype> <xsd:sequence> <xsd:element name="name"> <xsd:simpletype> <xsd:restriction base="xsd:string"> <xsd:minlength value="5"/> <xsd:maxlength value="8"/> </xsd:restriction> </xsd:simpletype> </xsd:element> <xsd:element name="car"> <xsd:simpletype> <xsd:restriction base="xsd:string"> <xsd:enumeration value="audi"/> <xsd:enumeration value="golf"/> <xsd:enumeration value="bmw"/> </xsd:restriction> </xsd:simpletype> </xsd:element> </xsd:sequence> </xsd:complextype> </xsd:element> <xsd:element name="helloresponse"> <xsd:complextype> <xsd:sequence> <xsd:element minoccurs="0" name="result" type="xsd:string"/> <xsd:element minoccurs="0" name="time" type="xsd:datetime"/> </xsd:sequence> </xsd:complextype> </xsd:element> </xsd:schema>
i using xsd validation tool on: http://www.utilities-online.info/xsdvalidation there got error:
not valid. error - line 2, 255: org.xml.sax.saxparseexception; linenumber: 2; columnnumber: 255; cvc-elt.1: cannot find declaration of element 'env:envelope'. error - line 5, 36: org.xml.sax.saxparseexception; linenumber: 5; columnnumber: 36; cvc-elt.4.2: cannot resolve 'ns1:hellorequest' type definition element 'input'. error - line 6, 27: org.xml.sax.saxparseexception; linenumber: 6; columnnumber: 27; cvc-elt.4.2: cannot resolve 'ns1:name' type definition element 'name'. error - line 7, 25: org.xml.sax.saxparseexception; linenumber: 7; columnnumber: 25; cvc-elt.4.2: cannot resolve 'ns1:car' type definition element 'car'.
i try xml->schemavalidate function in php. here got:
error 1845: element '{http://www.w3.org/2003/05/soap-envelope}envelope': no matching global declaration available validation root.
after reading lot of results in google found, have import envelope schema:
<xsd:import namespace="http://schemas.xmlsoap.org/soap/envelope/" schemalocation="http://schemas.xmlsoap.org/soap/envelope/"/>
but than, validation tool returns:
<html><head><title>apache tomcat/7.0.54 - error report</title><style><!--h1 {font-family:tahoma,arial,sans-serif;color:white;background-color:#525d76;font-size:22px;} h2 {font-family:tahoma,arial,sans-serif;color:white;background-color:#525d76;font-size:16px;} h3 {font-family:tahoma,arial,sans-serif;color:white;background-color:#525d76;font-size:14px;} body {font-family:tahoma,arial,sans-serif;color:black;background-color:white;} b {font-family:tahoma,arial,sans-serif;color:white;background-color:#525d76;} p {font-family:tahoma,arial,sans-serif;background:white;color:black;font-size:12px;}a {color : black;}a.name {color : black;}hr {color : #525d76;}--></style> </head><body><h1>http status 500 - access denied ("java.net.socketpermission" "schemas.xmlsoap.org:80" "connect,resolve")</h1><hr size="1" noshade="noshade"><p><b>type</b> exception report</p><p><b>message</b> <u>access denied ("java.net.socketpermission" "schemas.xmlsoap.org:80" "connect,resolve")</u></p><p><b>description</b> <u>the server encountered internal error prevented fulfilling request.</u></p><p><b>exception</b> <pre>java.security.accesscontrolexception: access denied ("java.net.socketpermission" "schemas.xmlsoap.org:80" "connect,resolve") java.security.accesscontrolcontext.checkpermission(accesscontrolcontext.java:472) java.security.accesscontroller.checkpermission(accesscontroller.java:884) java.lang.securitymanager.checkpermission(securitymanager.java:549) java.lang.securitymanager.checkconnect(securitymanager.java:1051) sun.net.www.http.httpclient.openserver(httpclient.java:510) sun.net.www.http.httpclient.<init>(httpclient.java:211) sun.net.www.http.httpclient.new(httpclient.java:308) sun.net.www.http.httpclient.new(httpclient.java:326) sun.net.www.protocol.http.httpurlconnection.getnewhttpclient(httpurlconnection.java:1169) sun.net.www.protocol.http.httpurlconnection.plainconnect0(httpurlconnection.java:1105) sun.net.www.protocol.http.httpurlconnection.plainconnect(httpurlconnection.java:999) sun.net.www.protocol.http.httpurlconnection.connect(httpurlconnection.java:933) sun.net.www.protocol.http.httpurlconnection.getinputstream0(httpurlconnection.java:1513) sun.net.www.protocol.http.httpurlconnection.getinputstream(httpurlconnection.java:1441) com.sun.org.apache.xerces.internal.impl.xmlentitymanager.setupcurrententity(xmlentitymanager.java:647) com.sun.org.apache.xerces.internal.impl.xmlversiondetector.determinedocversion(xmlversiondetector.java:148) com.sun.org.apache.xerces.internal.impl.xs.opti.schemaparsingconfig.parse(schemaparsingconfig.java:582) com.sun.org.apache.xerces.internal.impl.xs.opti.schemaparsingconfig.parse(schemaparsingconfig.java:685) com.sun.org.apache.xerces.internal.impl.xs.opti.schemadomparser.parse(schemadomparser.java:530) com.sun.org.apache.xerces.internal.impl.xs.traversers.xsdhandler.getschemadocument(xsdhandler.java:2179) com.sun.org.apache.xerces.internal.impl.xs.traversers.xsdhandler.resolveschema(xsdhandler.java:2082) com.sun.org.apache.xerces.internal.impl.xs.traversers.xsdhandler.constructtrees(xsdhandler.java:1012) com.sun.org.apache.xerces.internal.impl.xs.traversers.xsdhandler.parseschema(xsdhandler.java:623) com.sun.org.apache.xerces.internal.impl.xs.xmlschemaloader.loadschema(xmlschemaloader.java:613) com.sun.org.apache.xerces.internal.impl.xs.xmlschemaloader.loadgrammar(xmlschemaloader.java:572) com.sun.org.apache.xerces.internal.impl.xs.xmlschemaloader.loadgrammar(xmlschemaloader.java:538) com.sun.org.apache.xerces.internal.jaxp.validation.xmlschemafactory.newschema(xmlschemafactory.java:255) javax.xml.validation.schemafactory.newschema(schemafactory.java:638) info.utilitiesonline.backend.rest.xsdcontroller.validatexsd(xsdcontroller.java:70) info.utilitiesonline.backend.rest.xsdcontroller.validatexml(xsdcontroller.java:106) sun.reflect.generatedmethodaccessor58.invoke(unknown source) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:498) com.sun.jersey.spi.container.javamethodinvokerfactory$1.invoke(javamethodinvokerfactory.java:60) com.sun.jersey.server.impl.model.method.dispatch.abstractresourcemethoddispatchprovider$responseoutinvoker._dispatch(abstractresourcemethoddispatchprovider.java:205) com.sun.jersey.server.impl.model.method.dispatch.resourcejavamethoddispatcher.dispatch(resourcejavamethoddispatcher.java:75) com.sun.jersey.server.impl.uri.rules.httpmethodrule.accept(httpmethodrule.java:302) com.sun.jersey.server.impl.uri.rules.righthandpathrule.accept(righthandpathrule.java:147) com.sun.jersey.server.impl.uri.rules.resourceclassrule.accept(resourceclassrule.java:108) com.sun.jersey.server.impl.uri.rules.righthandpathrule.accept(righthandpathrule.java:147) com.sun.jersey.server.impl.uri.rules.rootresourceclassesrule.accept(rootresourceclassesrule.java:84) com.sun.jersey.server.impl.application.webapplicationimpl._handlerequest(webapplicationimpl.java:1542) com.sun.jersey.server.impl.application.webapplicationimpl._handlerequest(webapplicationimpl.java:1473) com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1419) com.sun.jersey.server.impl.application.webapplicationimpl.handlerequest(webapplicationimpl.java:1409) com.sun.jersey.spi.container.servlet.webcomponent.service(webcomponent.java:409) com.sun.jersey.spi.container.servlet.servletcontainer.service(servletcontainer.java:540) com.sun.jersey.spi.container.servlet.servletcontainer.dofilter(servletcontainer.java:909) com.sun.jersey.spi.container.servlet.servletcontainer.dofilter(servletcontainer.java:857) com.sun.jersey.spi.container.servlet.servletcontainer.dofilter(servletcontainer.java:811) com.google.inject.servlet.filterdefinition.dofilter(filterdefinition.java:163) com.google.inject.servlet.filterchaininvocation.dofilter(filterchaininvocation.java:58) com.google.inject.servlet.managedfilterpipeline.dispatch(managedfilterpipeline.java:118) com.google.inject.servlet.guicefilter.dofilter(guicefilter.java:113) sun.reflect.generatedmethodaccessor51.invoke(unknown source) sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) java.lang.reflect.method.invoke(method.java:498) org.apache.catalina.security.securityutil$1.run(securityutil.java:277) org.apache.catalina.security.securityutil$1.run(securityutil.java:274) java.security.accesscontroller.doprivileged(native method) javax.security.auth.subject.doasprivileged(subject.java:549) org.apache.catalina.security.securityutil.execute(securityutil.java:309) org.apache.catalina.security.securityutil.doasprivilege(securityutil.java:249)</pre></p><p><b>note</b> <u>the full stack trace of root cause available in apache tomcat/7.0.54 logs.</u></p><hr size="1" noshade="noshade"><h3>apache tomcat/7.0.54</h3></body></html>
so, have no idea have do, solve issue... looking forward hints.
thanks in advance
Comments
Post a Comment