标签: wsdl

使用ASP.NET的PHP SOAP WebService

我在使用ASP.NET尝试使用PHP SOAP Web服务时遇到了一些重大问题.有问题的Web服务基于PHP SOAP扩展,并由以下WSDL描述:

<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="MyServices"
  targetNamespace="http://mydomain.com/api/soap/v11/services"
  xmlns:tns="http://mydomain.com/api/soap/v11/services"
  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsd1="http://mydomain.com/api/soap/v11/services"
  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
  xmlns="http://schemas.xmlsoap.org/wsdl/">

<types>
    <schema targetNamespace="http://mydomain.com/api/soap/v11/services" xmlns="http://www.w3.org/2001/XMLSchema">
        <complexType name="ServiceType">
            <all>
                <element name="id" type="xsd:int" minOccurs="1" maxOccurs="1" />
                <element name="name" type="xsd:string" minOccurs="1" maxOccurs="1" />
                <element name="cost" type="xsd:float" minOccurs="1" maxOccurs="1" />
            </all>
        </complexType>
        <complexType name="ArrayOfServiceType">
            <all>
                <element name="Services" type="ServiceType" minOccurs="0" maxOccurs="unbounded" />
            </all>
        </complexType>
    </schema>
</types>


<message name="getServicesRequest">
    <part name="postcode" type="xsd:string" />
</message>

<message name="getServicesResponse">
  <part name="Result" type="xsd1:ArrayOfServiceType"/>
</message>

<portType name="ServicesPortType">
  <operation name="getServices">
    <input message="tns:getServicesRequest"/>
    <output message="tns:getServicesResponse"/>
  </operation> …
Run Code Online (Sandbox Code Playgroud)

.net php asp.net soap wsdl

5
推荐指数
1
解决办法
2716
查看次数

直接从源创建Web服务客户端

我试图直接从@Webservice类生成WS客户端jar.

我们来看这个例子:

   package com.example.maven.jaxws.helloservice;
   import javax.jws.WebService;
   @WebService
   public class Hello {
     public String sayHello(String param) {
     ;  return "Hello " + param;
     }
   }  
Run Code Online (Sandbox Code Playgroud)

我可以生成一个war文件并使用glassfish来提供这个webservice,从那里我可以使用glassfish WSDL URL来生成客户端源.

我想要做的是跳过glassfish部分.从定义webservice的maven项目开始,我想使用jaxws-maven-plugin来创建客户端类,但我找不到任何方法来指定webservice的实际URL.

应该可能吧?

@see还使用已知但无法访问的wsdl创建Web服务客户端

java wsdl maven-2 jax-ws

5
推荐指数
2
解决办法
1万
查看次数

在运行时更改WSDL EndPointAddress的地址/端口?

所以我目前在我的解决方案中添加了2个WSDL作为服务引用.它们在我的app.config文件中看起来像这样(我删除了"bindings"字段,因为它不感兴趣):

<system.serviceModel>
  <client>
    <endpoint address="http://localhost:8080/query-service/jse" binding="basicHttpBinding" bindingConfiguration="QueryBinding" contract="QueryService.Query" name="QueryPort" />
    <endpoint address="http://localhost:8080/dataimport-service/jse" binding="basicHttpBinding" bindingConfiguration="DataImportBinding" contract="DataService.DataImport" name="DataImportPort" />
  </client>   
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud)

当我使用WSDL时,它看起来像这样:

using (DataService.DataClient dClient = new DataService.DataClient())
{
  DataService.importTask impt = new DataService.importTask();
  impt.String_1 = "someData";
  DataService.importResponse imptr = dClient.importTask(impt);
}
Run Code Online (Sandbox Code Playgroud)

在"using"语句中,在实例化DataClient对象时,我有5个构造函数可供我使用.在这种情况下,我使用默认构造函数:

   new DataService.DataClient()
Run Code Online (Sandbox Code Playgroud)

它使用内置的端点地址字符串,我假设它是从app.config中提取的.但我希望应用程序的用户可以选择更改此值.

1)以编程方式获取此字符串的最佳/最简单方法是什么?

2)然后,一旦我允许用户编辑和测试值,我应该在哪里存储它?

我希望将它存储在一个地方(如app.config或等效的),这样就不需要检查值是否存在以及我是否应该使用备用构造函数.(为了保持我的密码,你知道吗?)

有任何想法吗?建议?

编辑

也许我应该问一下这些替代构造函数.

例如,其中一个看起来像这样:

   new DataService.DataClient(string endPointConfigurationName, 
                              string remoteAddress)
Run Code Online (Sandbox Code Playgroud)

可以为"endPointConfigurationName"和"remoteAddress"传递什么值?

EDIT2

在这里回答我自己的问题,"endPointConfigurationName"看起来与app.config XML中的"name"相同,"remoteAddress"的格式与app.config XML中的"endpoint address"相同.

也!关于获取EndPointAddresses的第一个问题的答案如下:

ClientSection clSection =
   ConfigurationManager.GetSection("system.serviceModel/client") as ClientSection;

ChannelEndpointElementCollection endpointCollection =
   clSection.ElementInformation.Properties[string.Empty].Value as ChannelEndpointElementCollection;

Dictionary<string, string> nameAddressDictionary = 
   new …
Run Code Online (Sandbox Code Playgroud)

wcf wsdl web-services app-config

5
推荐指数
1
解决办法
4193
查看次数

Delphi WSDL导入工具忽略"attributeGroup"引用

我是Web服务的新手,但对Delphi来说并不陌生.

我正在使用"WSDL Importer"向导将WSDL文件导入Delphi 2010.WSDL文件包含一些Delphi完全忽略的"attributeGroup"标签,这可能是一个bug,虽然我还没有在Quality Central上找到这个问题的条目,只在这里这里的论坛中提到.

我的问题有几个部分:

  1. 什么是最好的解决方法?
  2. 我编写了一个Python脚本来格式化WSDL文件,以便对attributeGroup标签的所有引用都替换为attributeGroups中定义的属性的声明; 换句话说,展平参考文献.输出通过"WSDL导入器"向导成功导入Delphi,看起来正确,但我还没有测试通过这个新的WSDL文件构造的消息是否能正常工作.这种策略是否可行,或者我现在应该放弃并转向其他更有效的方法?

更新

根据我的经验和这个问题的答案,我决定使用C#控制台应用程序进行包装路由,该应用程序使用JSON输入数据并输出JSON应答数据.Delphi应用程序驱动C#应用程序.整个事物的SOAP部分现在毫不费力,并且在C#.NET中"正常工作",其余功能由Delphi很好地处理.我会向其他有类似问题的人推荐这条路线.我确实尝试将C#SOAP程序集导出为COM库,并从Delphi连接到它,但它变得非常复杂,因为我的特定应用程序中的SOAP规范很大而且有点复杂.

delphi attributes soap wsdl

5
推荐指数
1
解决办法
1494
查看次数

使用共享类型创建Web服务和客户端

我创建了两个wsdl文件,其中包含从xsd模式文件导入的共享类型.

之后,我使用带有参数/ serverInterface的wsdl.exe工具生成的界面创建了Web服务.

第一个Web服务,通​​过系统"A"将Web方法"RegisterData"放入队列中一些复杂的对象进行处理.由于此方法返回布尔值(告诉我们对象已注册成功).

第二个Web服务,具有Web方法"UpdateData"以基于该相同对象更新系统"B"中的一些数据,并在系统"A"上进行了更改.

因此,在系统"A"中,我必须为第二个Web服务创建客户端,我将使用此修改后的复杂对象us参数调用方法"UpdateData".

但是,当我在Visual Studio中创建此客户端时(通过添加Web引用或添加服务引用),我必须为客户端创建一些命名空间.然后,当我试图调用"UpdateData"时,agument对于从第一个Web服务"RegisterData"方法接收的同一个对象具有不同的命名空间.

我想创建第一个Web服务和第二个Web服务客户端,我可以在它们之间使用相同类型的对象.

非常感谢你的帮助.

c# wsdl web-services asmx wsdl.exe

5
推荐指数
1
解决办法
3784
查看次数

如何修复Visual Studio生成的用于处理锯齿状数组的Web引用代理?

似乎wsdl.exe中存在一个已知错误,即Visual Studio用于生成Web服务代理的工具.使用某些XSD架构,该工具将生成无法从XML反序列化的类.

至于我担心这是不可接受的,但我不知道如何解决它.

我将详细描述我的案例,希望有人能够帮助我.

架构

<!-- return type from the service operation -->
<xs:complexType name="listAssetsQueryResults">
    <xs:sequence>
        <xs:element name="assets" type="tns:asset" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>

<!-- a sequence of attributes -->
<xs:complexType name="asset">
    <xs:sequence>
        <xs:element name="attributes" type="tns:multiValuedAttribute" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:complexType>

<xs:complexType name="multiValuedAttribute">
    <!-- not relevant-->
</xs:complexType>
Run Code Online (Sandbox Code Playgroud)

来自Web服务的XML响应

根据此模式的典型响应如下所示:

<assets-query-result>
    <assets>
        <attributes>
            <name>Keywords</name>
            <values>Desert</values>
        </attributes>
        <attributes>
            <name>Filename</name>
            <values>Desert.jpg</values>
        </attributes>
    </assets>
    <assets>...</assets>
    <assets>...</assets>
</assets-query-result>
Run Code Online (Sandbox Code Playgroud)

使用代码中的类型

我原以为能够使用这样的CLR类型:

result.assets[0].attributes[0].name
Run Code Online (Sandbox Code Playgroud)

相反,生成的结果类型如下所示:

[SerializableAttribute()]
public partial class listAssetsQueryResults {
    private multiValuedAttribute[][] assetsField;

    [XmlArrayAttribute(Form=XmlSchemaForm.Unqualified, IsNullable=true)]
    [XmlArrayItemAttribute("attributes", typeof(multiValuedAttribute), Form=XmlSchemaForm.Unqualified)]
    public …
Run Code Online (Sandbox Code Playgroud)

.net xsd wsdl web-services xml-serialization

5
推荐指数
1
解决办法
1747
查看次数

无法为WSDD操作找到匹配的Java操作

我为以下代码创建了一个Web服务,但是我得到了一个异常:

org.apache.axis.InternalException:java.lang.Exception:无法在调用函数时找到WSDD操作"andrQues"(0 args)"的匹配Java操作.

public class Ques {
    public String[] AndrQues(){
        String ques[] = {"name??", "age??", "grade??"};
        return ques;
    }

}
Run Code Online (Sandbox Code Playgroud)

有谁知道它为什么会发生?wsdl也没有生成.

java axis wsdl web-services

5
推荐指数
1
解决办法
1万
查看次数

WCF Delphi7方法输入参数

我有wcf web-service(basicHttpBinding).我们的Delphi7客户端无法正确使用它.我已经使用WCF附加功能展平了WSDL.好.Delphi7 wsdl导入器生成代理正确.

现在我遇到了输入参数的问题.它们总是有默认值(对于字符串为空,对于int为0).

方法delphi7的输出值可以正常.例如:

        public string Test(string a)
        {
              return "Test"+a;
        }
Run Code Online (Sandbox Code Playgroud)

此方法始终返回"测试".我的日志系统修复了我已经空了一个方法,所以问题是正确的传输输入参数.

我不能忽视什么是错的

编辑

代理:

ISyncer = interface(IInvokable)
  ['{D46862B0-BDD3-8B80-35A8-A2AC69F24713}']
    function  Test(const a: String): String; stdcall;
  end;
Run Code Online (Sandbox Code Playgroud)

呼叫:

Sync:=(dmMain.HTTPRIO1 as ISyncer);
test:=Sync.Test('5555');
Run Code Online (Sandbox Code Playgroud)

dmMain.HTTPRIO1在选项中有soLiteralParams:

在里面:

InvRegistry.RegisterInvokeOptions(TypeInfo(ISyncer), ioLiteral);
Run Code Online (Sandbox Code Playgroud)

通话结束后,我收到消息的异常:

Error deserializtion message body for operation Test. 
Operation formatter detects ivalid message body. Expecting node type "Element"
with name "Test" and namespace "http://tempuri.org". Actually node type "Element"
with name "xsd:String" and namespace "http://w3.org/2001/XMLSchema"
Run Code Online (Sandbox Code Playgroud)

wsdl片段:

<xsd:element name="Test">
?
<xsd:complexType>
?
<xsd:sequence>
<xsd:element minOccurs="0" …
Run Code Online (Sandbox Code Playgroud)

.net delphi wcf wsdl web-services

5
推荐指数
1
解决办法
1706
查看次数

带有WSDL文件的Spyne Soap服务器

我正在尝试将Soap服务器从旧的PHP项目移植到Python.Django确切地说.在PHP中使用

$server = new SOAPServer("xyz.wsdl", ....
Run Code Online (Sandbox Code Playgroud)

据我所知

app = Application([HelloWorldService], 'spyne.examples.hello.http',
    in_protocol=Soap11(validator='lxml'),
    out_protocol=Soap11(),
)
Run Code Online (Sandbox Code Playgroud)

是使用Spyne启动Soap服务器的唯一方法,Spyne是否能够使用WSDL文件创建Soap服务器?

python soap wsdl spyne

5
推荐指数
1
解决办法
1132
查看次数

Spring WS WSDL自动公开:不遵循xsd导入

我正在尝试基于多个xml模式为Spring WS Web服务动态生成WSDL。我有多个xsd文件,所有文件都使用xsd:import元素“连接”。

Spring WS参考说:

如果要使用包含或导入的多个模式,则需要将Commons XMLSchema放在类路径上。如果Commons XMLSchema位于类路径上,则上述元素将跟随所有XSD导入和包含,并将它们作为单个XSD内联到WSDL中。这极大地简化了架构的部署,仍然使分别编辑它们成为可能。

所以我添加了这个Maven依赖项:

    <dependency>
        <groupId>org.apache.ws.xmlschema</groupId>
        <artifactId>xmlschema-core</artifactId>
        <version>2.2.1</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

并以这种方式配置WSDL构建器:

@Bean(name="updateContactService")
public DefaultWsdl11Definition defaultWsdl11Definition() throws Exception {
    DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
    wsdl11Definition.setPortTypeName("updateContactPort");
    wsdl11Definition.setLocationUri("/ws/updateContact");
    wsdl11Definition.setTargetNamespace("http://spring.io/guides/gs-producing-web-service");
    wsdl11Definition.setSchema(updateContactXsd());
    return wsdl11Definition;
}   

@Bean
public XsdSchemaCollection updateContactXsd() throws Exception {
    return new SimpleXsdSchema(new ClassPathResource("xsds/contact/outboundMessage.xsd"));
}
Run Code Online (Sandbox Code Playgroud)

但是生成的WSDL仅包含一个架构元素(并以错误的位置显示了导入)。

<xs:import namespace="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" schemaLocation="personService.xsd"/>
Run Code Online (Sandbox Code Playgroud)

有小费吗?Spring WS版本是2.3.1

<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.io/guides/gs-producing-web-service" targetNamespace="http://spring.io/guides/gs-producing-web-service">
  <wsdl:types>
    <xs:schema xmlns="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:ns2="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" xmlns:tns0="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/">
    <xs:import namespace="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" schemaLocation="personService.xsd"/>
    <xs:element name="process" type="tns0:processType"/>
    <xs:complexType name="processType">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" …
Run Code Online (Sandbox Code Playgroud)

java spring xsd wsdl spring-ws

5
推荐指数
1
解决办法
4299
查看次数