1

我在.Net中编写了一个 Web 服务,并从我的Android应用程序中调用它。下面是它的描述,它很容易理解,并提供了从 Android 调用服务的所有必要信息,特别是例如 SOAPACTION、内容类型等我可以通过链接看到它的内容看起来像这样,实际上 .Net 接口提供了这个

http://192.168.4.47:88/MRMSGlobalService.asmx?op=EstimateTripCost

现在我有另一个用Java编写的 Web 服务,它的描述在这个 .net 服务下面给出。我可以通过如下链接打开它的描述

http://localhost:8080/MusicAppService/MusicAppDataService?WSDL

它的描述不像 .Net 那样容易理解,而且非常难以理解,实际上它的WSDL但我想要一个像 .Net 的接口。它是用 NetBeans 编写的。

我认为可能有一种方法可以让我们看到与 .net 服务相同的描述。对此,我无法理解如何操作数据。

我必须调用函数getMusicFileData但很难理解参数是什么以及返回数据可能是什么。

请帮忙。我想要与 .net 一样的 java web 服务的相同描述,这很容易理解。URL中应该有东西;什么,这是要找的。

.Net 网络服务

POST /SDApp/MRMSGlobalService.asmx HTTP/1.1
Host: 192.168.4.47
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://Itcurves.net/EstimateTripCost"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <EstimateTripCost xmlns="http://Itcurves.net/">
      <NoOfPassengers>int</NoOfPassengers>
      <NoOfWheelChairs>int</NoOfWheelChairs>
      <Distance>double</Distance>
      <Duration>double</Duration>
    </EstimateTripCost>
  </soap:Body>
</soap:Envelope>

Java 网络服务

This document had no style information.
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.2-b13 (branches/2.2-6964; 2012-01-09T18:04:18+0000) JAXWS-RI/2.2.6-promoted-b20 JAXWS/2.2 svn-revision#unknown. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.2-b13 (branches/2.2-6964; 2012-01-09T18:04:18+0000) JAXWS-RI/2.2.6-promoted-b20 JAXWS/2.2 svn-revision#unknown. -->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://Musicpackage/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://Musicpackage/" name="MusicAppDataService">
<wsp:Policy xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" xmlns:ssp="http://schemas.sun.com/2006/03/wss/server" xmlns:sunwsp="http://java.sun.com/xml/ns/wsit/policy" wsu:Id="MusicAppDataPortBindingPolicy">
<sp:SymmetricBinding>
<wsp:Policy>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:IncludeTimestamp/>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
<sp:OnlySignEntireHeadersAndBody/>
<sp:ProtectionToken>
<wsp:Policy>
<sp:SecureConversationToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:BootstrapPolicy>
<wsp:Policy>
<sp:AsymmetricBinding>
<wsp:Policy>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:IncludeTimestamp/>
<sp:InitiatorToken>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssX509V3Token10/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:InitiatorToken>
<sp:Layout>
<wsp:Policy>
<sp:Strict/>
</wsp:Policy>
</sp:Layout>
<sp:OnlySignEntireHeadersAndBody/>
<sp:RecipientToken>
<wsp:Policy>
<sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never">
<wsp:Policy>
<sp:RequireIssuerSerialReference/>
<sp:WssX509V3Token10/>
</wsp:Policy>
</sp:X509Token>
</wsp:Policy>
</sp:RecipientToken>
</wsp:Policy>
</sp:AsymmetricBinding>
<sp:EncryptedParts>
<sp:Body/>
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="ReplyTo"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="To"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="From"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="AckRequested"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="CreateSequence"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="Sequence"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="MessageID"/>
<sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="SequenceAcknowledgement"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="Action"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="RelatesTo"/>
</sp:SignedParts>
<sp:Wss10>
<wsp:Policy>
<sp:MustSupportRefIssuerSerial/>
</wsp:Policy>
</sp:Wss10>
</wsp:Policy>
</sp:BootstrapPolicy>
<sp:RequireDerivedKeys/>
</wsp:Policy>
</sp:SecureConversationToken>
</wsp:Policy>
</sp:ProtectionToken>
</wsp:Policy>
</sp:SymmetricBinding>
<sp:Trust13>
<wsp:Policy>
<sp:MustSupportIssuedTokens/>
<sp:RequireClientEntropy/>
<sp:RequireServerEntropy/>
</wsp:Policy>
</sp:Trust13>
<sp:Wss11>
<wsp:Policy>
<sp:MustSupportRefEncryptedKey/>
<sp:MustSupportRefIssuerSerial/>
<sp:MustSupportRefThumbprint/>
</wsp:Policy>
</sp:Wss11>
<wsam:Addressing/>
</wsp:Policy>
<wsp:Policy xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="MusicAppDataPortBinding_getMusicFileData_Input_Policy">
<sp:EncryptedParts>
<sp:Body/>
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="ReplyTo"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="To"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="From"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="AckRequested"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="CreateSequence"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="Sequence"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="MessageID"/>
<sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="SequenceAcknowledgement"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="Action"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="RelatesTo"/>
</sp:SignedParts>
</wsp:Policy>
<wsp:Policy xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702" wsu:Id="MusicAppDataPortBinding_getMusicFileData_Output_Policy">
<sp:EncryptedParts>
<sp:Body/>
</sp:EncryptedParts>
<sp:SignedParts>
<sp:Body/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="ReplyTo"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="To"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="From"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="AckRequested"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="CreateSequence"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="Sequence"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="MessageID"/>
<sp:Header Name="FaultTo" Namespace="http://www.w3.org/2005/08/addressing"/>
<sp:Header Namespace="http://docs.oasis-open.org/ws-rx/wsrm/200702" Name="SequenceAcknowledgement"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="Action"/>
<sp:Header Namespace="http://www.w3.org/2005/08/addressing" Name="RelatesTo"/>
</sp:SignedParts>
</wsp:Policy>
<types>
<xsd:schema>
<xsd:import namespace="http://Musicpackage/" schemaLocation="http://localhost:8080/MusicAppService/MusicAppDataService?xsd=1"/>
</xsd:schema>
</types>
<message name="getMusicFileData">
<part name="parameters" element="tns:getMusicFileData"/>
</message>
<message name="getMusicFileDataResponse">
<part name="parameters" element="tns:getMusicFileDataResponse"/>
</message>
<portType name="MusicAppData">
<operation name="getMusicFileData">
<input wsam:Action="http://Musicpackage/MusicAppData/getMusicFileDataRequest" message="tns:getMusicFileData"/>
<output wsam:Action="http://Musicpackage/MusicAppData/getMusicFileDataResponse" message="tns:getMusicFileDataResponse"/>
</operation>
</portType>
<binding name="MusicAppDataPortBinding" type="tns:MusicAppData">
<wsp:PolicyReference URI="#MusicAppDataPortBindingPolicy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getMusicFileData">
<soap:operation soapAction=""/>
<input>
<wsp:PolicyReference URI="#MusicAppDataPortBinding_getMusicFileData_Input_Policy"/>
<soap:body use="literal"/>
</input>
<output>
<wsp:PolicyReference URI="#MusicAppDataPortBinding_getMusicFileData_Output_Policy"/>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MusicAppDataService">
<port name="MusicAppDataPort" binding="tns:MusicAppDataPortBinding">
<soap:address location="http://localhost:8080/MusicAppService/MusicAppDataService"/>
</port>
</service>
</definitions>**strong text****strong text**
4

2 回答 2

2

You must have checked (or you did not unchecked) "use WS-Security" checkbox in NetBeans web services generator. This additional stuff you see in Java web service SOAP envelope is connected with WS-Security information.

于 2012-04-13T21:37:27.403 回答
1

在项目视图中,右键单击 Web 应用程序 -> Web 服务 -> WebServiceNode

从列表中选择“编辑 Web 服务属性”

取消选中安全服务复选框

单击确定,它应该可以工作。

查看Glen Mazza 的博客

于 2012-04-15T11:56:31.327 回答