使用专用的WSDL创建Web服务客户端

问题描述 投票:0回答:2

我想使用eclipse在Java中创建一个肥皂网络服务客户端。如果wsdl是私有的,我该怎么办?

我已经尝试过此处描述的方法:https://www.youtube.com/watch?v=11iGyrvBhzc

我尝试使用另一个WSDL链接(https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl),它会生成文件。这样就可以了。

尚未进入代码部分。我的问题是,当我使用自己感兴趣的WSDL链接尝试该方法时,该方法无效,因为WSDL链接是私有的。只有我公司的人员可以访问它。如何建立连接?

预期结果是我的Eclipse资源管理器中的一组文件

java eclipse webservice-client
2个回答
0
投票

我遇到了同样的问题,必须进行彻底的研究。这是我在Oracle Doc处发现的。

导入的WSDL文件

[当您想在Workshop中使用外部Web服务时,请先获取您要使用的服务的WSDL文件。对于公共Web服务,WSDL文件将通常可以在发布Web服务的组织的网站上找到。

对于私有Web服务,请与支持Web服务的组织联系以获取WSDL文件。

当我联系发布Web服务的组织时,他们给了我以下内容

  1. Web服务网址
  2. Web服务规范,其中包括xml请求和响应格式,以及Web服务方法。

利用以上信息,我能够成功使用组织的Web服务。


0
投票

通过Maven插件,您可以生成指向本地目录的文件,如下所示:

<plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>mkdir</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>mkdir</executable>
                            <arguments>
                                <argument>-pv</argument>
                                <argument>target/generated-sources/wsimport</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>magento_wsdl</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>java</executable>

                            <arguments>
                                <argument>-classpath</argument>
                                <classpath/>
                                <argument>com.sun.tools.ws.WsImport</argument>
                                <argument>-extension</argument>
                                <argument>-Xnocompile</argument>
                                <argument>-catalog</argument>
                                <argument>/META-INF/jax-ws-catalog.xml</argument>
                                <argument>-wsdllocation</argument>
                                <argument>/META-INF/file.wsdl</argument>
                                <argument>-s</argument>
                                <argument>target/generated-sources/wsimport</argument>
                                <argument>src/main/resources/META-INF/magentowsion.wsdl</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
© www.soinside.com 2019 - 2024. All rights reserved.