我已经尝试使用 Axis2Code 生成器和 Xfire 从 WSDL 生成 javasource 代码,但它无法连接(声明连接被拒绝),SOAPUI 也是如此。
但我可以在浏览器中浏览相同的 WSDL。
是否有其他 API 可以帮助从 WSDL 生成代码?
请建议
我们将根据运行时读取的元数据构建一个 Web 服务。我指的是整个网络服务:签名、合同和实施。
从这里我看到有两条主要路径。
第一条路径是生成代码。您可以在字符串中生成 C# 代码并即时编译它,或者更优雅(且复杂)地发出 MSIL 代码。这样您就拥有了 WCF 代码,WCF 将负责从中生成 WSDL。
第二条途径是使用通用服务。具有接受所有内容的操作消息进程(消息)的服务。我们仍然希望将服务公开为“普通”服务,因此我需要在某个地方使用 WSDL。如何创建 WSDL?我考虑过使用 System.ServiceModel.Description,直到我意识到,在内心深处,这个 API 依赖于具体类型。通过这种方法,我们不会有任何数据协定类型,并且可以动态处理 XML,使用元数据来解释它。因此我们需要以某种方式生成 WSDL。这是一个疯狂的想法吗?WSDL 有一个相当复杂的规范...
第三种选择是使用混合方法,发出类型只是为了创建签名,但使用非发出代码(反映发出的类型)来实现服务。很奇怪,但可能比手工制作 WSDL 更简单......
建议?
我需要在 OSB 中虚拟化一个 Web 服务,但最终的 wsdl 与业务服务相同(它是一个 asxm,所有内容都只在一个文件中),这是可以的,但是导出 wsdl 后有不同的表示法,请参阅下面的例子:
预期和原始
<wsdl:output>
<soap:body use="literal" />
<soap:header message="tns:GetPPDeluxeSubscriberInformationVersionInfoHeader" part="VersionInfoHeader" use="literal" />
</wsdl:output>
Run Code Online (Sandbox Code Playgroud)
我得到的:
<WL5G3N0:output>
<WL5G3N2:header message="WL5G3N1:GetPPDeluxeSubscriberInformationVersionInfoHeader" part="VersionInfoHeader" use="literal"/>
<WL5G3N2:body use="literal"/>
</WL5G3N0:output>
Run Code Online (Sandbox Code Playgroud)
我得到的符号是 WL5G3N0 或 WL5GN1,而不是肥皂、wsdl 或 tns。
那么有人知道我该如何解决这个问题吗?
谢谢
我正在使用CXF(wsdl2java)wsdl文件生成类,但一个枚举被映射到Stringonly。
如果我打开生成的类,这是 wsdl 片段:
<complexType>
<complexContent>
<restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
<attribute name="Type" use="required">
<simpleType>
<restriction base="{http://www.w3.org/2001/XMLSchema}string">
<enumeration value="AAA"/>
<enumeration value="VVV"/>
</restriction>
</simpleType>
</attribute>
</restriction>
</complexContent>
</complexType>
Run Code Online (Sandbox Code Playgroud)
为什么结果是 aString而不是 an Enum?这是自动生成的结果:
private String type;
public String getType() {
return type;
}
public void setType(String value) {
this.type = value;
}
Run Code Online (Sandbox Code Playgroud)
更新:自定义绑定文件:
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
jaxb:version="2.1">
<jaxb:bindings>
<jaxb:bindings node="//xs:attribute[@name='Type']/xs:simpleType">
<jaxb:typesafeEnumClass ref="TestEnum" />
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
Run Code Online (Sandbox Code Playgroud) 我对 gSoap 有疑问。我通过运行以下命令生成文件:
wsdl2h -o calc.h http://www.genivia.com/calc.wsdl
soapcpp2 -i -j -I/usr/share/gsoap/import calc.h
Run Code Online (Sandbox Code Playgroud)
之后,我将这些文件包含到我的项目中
轮廓:
TARGET = calc
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp\
test/soapC.cpp\
test/soapcalcProxy.cpp\
HEADERS += mainwindow.h \
test/soapcalcProxy.h \
test/soapH.h \
test/soapStub.h \
FORMS += mainwindow.ui
Run Code Online (Sandbox Code Playgroud)
主程序
#include "mainwindow.h"
#include <QApplication>
#include "test/soapcalcProxy.h"
#include "test/calc.nsmap"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
calcProxy service;
MainWindow w;
w.show();
return a.exec();
}
Run Code Online (Sandbox Code Playgroud)
现在我有很多错误,其中包括
soapC.cpp:187: error: undefined reference to `soap_lookup_type'
Run Code Online (Sandbox Code Playgroud)
我正在寻找一些答案,但只找到了有关的信息stdsoap2.cpp(我必须将其包含在我的项目中)。我有 gSoap 2.8,但没有这个文件。我只有stdsoap2.h。
我应该做什么?
我的公司正在尝试找出如何将我们当前的相机系列转变为符合 ONVIF 标准的相机。
我找到的是规范文档和一堆 WSDL 文件。但到目前为止我所看到的一切似乎都在建立事物的“客户端”。
我正在尝试创建一个中间件服务,以便我们现有的摄像机可以支持 ONVIF。
WSDL 文件是否同时用于客户端和设备?
公司如何对符合 ONVIF 标准的摄像机进行编程?我们的是 PTZ,PTZ WSDL 是我要找的吗?
服务设备端如何启动。尽管该规范涵盖了所有内容,但对于该标准的新开发人员来说,它的编写效果并不好。
请帮助我弄清楚如何将 C++ 中的嵌入式 Linux 相机转换为符合 ONVIF 的相机。开发人员是否使用 WSDL 来实现此目的?
谢谢你!
我尝试了一个关于通过 Spring Boot 使用 SOAP Web 服务的教程(入门 - 使用 SOAP Web 服务)。但是在运行 Maven 构建时不会生成这些类。我对这个主题完全陌生,需要一些帮助来找出我的错误。这是我的 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.baumgarten</groupId>
<artifactId>springwsdlconsume</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- tag::wsdl[] -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.12.3</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>de.baumgarten.springwsdlconsume.hello.wsdl</generatePackage>
<schemas>
<schema>
<url>http://localhost:8080/ws/my_wsdl.wsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
<!-- end::wsdl[] …Run Code Online (Sandbox Code Playgroud) 假设我使用 python zeep 对这样的服务器执行查询:
from zeep import Client
wsdl_url = "http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso?WSDL"
client = Client(wsdl_url)
result = client.service.ListOfContinentsByCode()
Run Code Online (Sandbox Code Playgroud)
我想看到从这个方法返回的原始 XML,即以某种方式从结果中提取它。这可能吗?如何?
如何使用 gradle 5 从 Java 11 中的 WSDL 生成类?
我正在使用 wsimport seeber 插件,但它看起来在 java 11 中不起作用
dependencies {
classpath "gradle.plugin.me.seeber.gradle:gradle-wsimport-plugin:1.1.1"
}
Run Code Online (Sandbox Code Playgroud)
在 Intelij Idea 我得到:
- 出了什么问题:配置项目“:ReturnRedirectWorker-api”时出现问题。
执行模型规则时抛出异常:WsimportPlugin.PluginRules#createWsdlSourceSets(ModelMap, FileOperations) > create(wsdlMain) > create(wsdl) 无法创建 WsdlSourceSet 类型的 LanguageSourceSet
我正在使用 JAX-WS RI 与第三方 Web 服务 (Adyen) 集成。我已经下载了他们的 wsdl 副本,并jaxws:wsdl2java在我的构建中使用以生成 Web 服务实现源代码。在运行时,当我尝试通过调用我自动生成的支付服务类的 getPort() 方法来设置端口时,我收到以下异常,声称有一个公开的方法,但它不存在于 wsdl portType 元素中:
javax.xml.ws.WebServiceException: Method adjustAuthorisation is exposed as WebMethod, but there is no corresponding wsdl operation with name {http://payment.services.adyen.com}adjustAuthorisation in the wsdl:portType{http://payment.services.adyen.com}PaymentPortType
Run Code Online (Sandbox Code Playgroud)
但是,它存在于 portType 元素中。这是 wsdl 的相关片段:
javax.xml.ws.WebServiceException: Method adjustAuthorisation is exposed as WebMethod, but there is no corresponding wsdl operation with name {http://payment.services.adyen.com}adjustAuthorisation in the wsdl:portType{http://payment.services.adyen.com}PaymentPortType
Run Code Online (Sandbox Code Playgroud)
完整的 wsdl 可以在这里看到:https ://pal-live.adyen.com/pal/servlet/Payment/v30?wsdl
wsdl 包含在具有类路径 /wsdl/Payment.wsdl 的目标 jar 中。我在运行时使用配置类中的代码加载它:
<wsdl:portType name="PaymentPortType">
<wsdl:operation name="adjustAuthorisation">
<wsdl:input …Run Code Online (Sandbox Code Playgroud)