donpb2823 2013-09-11 12:18
浏览 172

Soap-error Parsing Schema:无法从意外的targetNamespace导入模式

I have a PHP Soap-Server. When a (for example) python-suds script is asking the WSDL it gets it correct. The WSDl does import an XSD that's located somewhere on the same site. Also this goes well, as python can use the factory to create the type that is defined in the imported xsd. When the request is handled with client.service.ActionName() the PHP script starts.

PHP initializes its own wsdl first, and then gets an error on the import of the xsd located on his server.

Short question: why can python load the xsd import while php can not?

Here you have the beginning of the wsdl:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://---/webservices/2012-09/" xmlns:eba="http://---/schemas/1-0/" xmlns:xsd="http://www.w3.org/2001/XMLSchema/" targetNamespace="http://---/webservices/2012-09/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/">
<wsdl:types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://---/webservices/2012-09/" elementFormDefault="qualified">
        <xsd:import namespace="http://---/schemas/1-0/" schemaLocation="xsd/XSDName"/>
    </xsd:schema>
</wsdl:types>

this is the beginning of the xsd:

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:element name="ElementName" type="ElementType">

This is the Python script:

url = 'http://---/wsdl&' + str(uuid.uuid1())
client = Client(url)

print client

wb = client.factory.create('ns0:MyType')
print wb

post_result = client.service.RequestFunction(wb)

This is the PHP script:

$soapServer = new SoapServer('http://---/wsdl'); // <-- fails here
$soapServer->setClass('SoapHandler'); 
$soapServer->handle(); 
  • 写回答

1条回答 默认 最新

  • drxvjnx58751 2013-10-09 13:50
    关注

    There are two obvious differences:

    1. in PHP you're using SoapServer instead of SoapClient
    2. in Python your URL is different than in PHP - you add some userid or something like that /wsdl& + str(uuid.uuid1()) vs. /wsdl
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题