我正在使用PHP SOAPSERVER类.
作为响应,我发送关联的php数组:
function getItems()
{
...
$items[] = Array("itemID" =>$itemID,"itemName"=>$itemName);
return $items;
}
Run Code Online (Sandbox Code Playgroud)
SOAP返回是这样的:
...
<Items>
<item type="Map">
<item>
<key type="string">
itemID
</key>
<value type="string">
17558
</value>
</item>
<item>
<key type="string">
itemName
</key>
<value type="string">
I-17558
</value>
</item>
</item>
</Items>
...
Run Code Online (Sandbox Code Playgroud)
这种回归很难分析人类(给定更大的数组).首选形式如下:
...
<Items>
<item>
<itemID>17558</itemID>
<itemName>I-17558</itemName>
</item>
<item>
<itemID>17559</itemID>
<itemName>I-17559</itemName>
</item>
</Items>
...
Run Code Online (Sandbox Code Playgroud)
这样的SOAP返回是否可行(不改变返回类型 - 数组)?怎么样?
我刚刚开始使用SOAP,大多数教程都展示了如何返回像string这样的简单类型.
我正在使用WAMP和CakePHP,并试图在混合中添加一个NuSOAP服务器.我可以通过NuSOAP生成动态WSDL,但底部有一个由NuSOAP设置的参数,并且没有任何意义:
<soap:address location="http://localhost/cakephp/app/webroot/index.php"/>
Run Code Online (Sandbox Code Playgroud)
正确的是:
<soap:address location="http://localhost/cakephp/web_service/web_service"/>
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚如何更改它,甚至根本不知道NuSOAP在哪个位置(我的代码中完全没有引用它).
这是我正在使用的代码:
class WebServiceController extends AppController {
var $components = array('RequestHandler');
public function web_service()
{
$this->layout = FALSE;
$this->autoRender = FALSE;
Configure::write('debug', 0);
$this->RequestHandler->respondAs('xml');
App::import('Vendor', 'nusoap', array('file' => 'nusoap'.DS.'lib'.DS.'nusoap.php'));
include 'local_functions.php';
if ( !isset( $HTTP_RAW_POST_DATA ) ) $HTTP_RAW_POST_DATA =file_get_contents( 'php://input' );
$server = new soap_server();
$namespace = "http://localhost/web_service/web_service";
$server->configureWSDL("web-service", $namespace);//, "urn:web-service");
$server->wsdl->schemaTargetNamespace = $namespace;
include 'wsdl_types.php';
$server->register("Subscribe", array("accessKey" => "xsd:string","publisher" => "xsd:string","subscribeData" => "xsd:string"), array("return" => "xsd:string"), "urn:web-service", "urn:web-service#Subscribe", "rpc", "encoded", "Subscribe to mail …Run Code Online (Sandbox Code Playgroud) 我有以下代码示例:
PlentySoapRequest_GetAuthentificationToken username = new PlentySoapRequest_GetAuthentificationToken();
username.Username = user_textbox.ToString();
username.Userpass = password_textbox.ToString();
Uri uri = new Uri("http://www.****.de/plenty/api/soap/version105/");
XNamespace soapenv = @"http://schemas.xmlsoap.org/soap/envelope/";
XNamespace xsi = @"http://www.w3.org/2001/XMLSchema-instance";
XNamespace xsd = @"http://www.w3.org/2001/XMLSchema";
XNamespace ver = @"http://www.****.de/plenty/api/soap/version105/";
var document = new XDocument(
new XDeclaration("1.0", "utf-8", String.Empty),
new XElement(soapenv + "Envelope",
new XAttribute(XNamespace.Xmlns + "xsi", xsi),
new XAttribute(XNamespace.Xmlns + "xsd" , xsd),
new XAttribute(XNamespace.Xmlns + "soapenv" , soapenv),
new XAttribute(XNamespace.Xmlns + "ver" , ver),
new XElement(soapenv + "Header"),
new XElement(soapenv + "Body",
new XElement(ver + …Run Code Online (Sandbox Code Playgroud) 我有一个wsdl的网络服务.我想使用此wsdl文件生成soap请求消息的结构.使用wsdl文件生成示例soap请求消息的最佳方法是什么?我希望这可以使用基于java的技术完成.
谢谢
我有以下简单的WCF库,它是在Visual Studio 2008上开发的.
当运行调用此wcf服务的WCFTestClinet/javascript(使用SOAP)时,我得到以下场景的错误值:
1.GetNumber - > output:"您的号码是0"
2.SetNumber - >无输出
3. GetNumber - >输出:"你的号码是0" 而不是输出:"你的号码是8"!!!
任何人都可以解释为什么会发生这种情况,我该如何解决?
谢谢
public class Service1 : IService1
{
private int Number;
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
public string GetNumber()
{
return string.Format("Your number is : {0}", Number);
}
public void SetNumber()
{
Number = 8;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在开发一个基于SOAP的SOA项目.好吧,我在互联网上阅读了很多教程,但我仍然有同样的问题,这是所有文章和博客,甚至eclipse的官方文档告诉你如何使用IDE助手或这样的API和框架(例如:JAX-WS, CXF)创建一个Web服务,并为您提供SOAP,WSDL和UDDI的一些定义,但没有一个解释SOA如何工作,发布和部署WS的过程以及C/S req/resp如何使用所有这些实体SOAP,WSDL和UDDI以及SOA项目中存在的其他文件(XML文件和Java文件)来完成远程Web服务的调用过程.我已经阅读了很多电子书,但仍然不了解SOA的工作原理.pliiiz我需要你的帮助,我真的很不安和困惑.提前谢谢了.
我已经为以下所有设置了一致的命名空间(http://somenamespace.com/2012/10/):
但是我在服务日志(.svclog)文件上收到此错误.有人可以开导我这个吗?我已经咨询了几个网站,但无济于事.
这是一个很好的参考:http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/ee11d86f-f25c-4284-8f51-b1f035346cb3/
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131074</EventID>
<Type>3</Type>
<SubType Name="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2013-01-04T06:57:48.7620812Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{eadc96c2-323f-41df-bc3d-df56367dda52}" />
<Execution ProcessName="w3wp" ProcessID="2088" ThreadID="54" />
<Channel />
<Computer>SOMECOMPUTER007</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.EventLog.aspx</TraceIdentifier>
<Description>Wrote to the EventLog.</Description>
<AppDomain>/LM/W3SVC/1/ROOT/SomeApplication-1-130017541311895789</AppDomain>
<ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord">
<CategoryID.Name>EventLogCategory</CategoryID.Name>
<CategoryID.Value>7</CategoryID.Value>
<InstanceID.Name>EventId</InstanceID.Name>
<InstanceID.Value>3221356549</InstanceID.Value>
<Value0>System.ArgumentException: The 'http://somenamespace.com/2012/10/' namespace is not defined.
at System.Xml.XmlWriter.WriteQualifiedName(String localName, String ns)
at System.Runtime.Serialization.XmlWriterDelegator.WriteAttributeQualifiedName(String attrPrefix, XmlDictionaryString attrName, XmlDictionaryString attrNs, XmlDictionaryString name, XmlDictionaryString ns) …Run Code Online (Sandbox Code Playgroud) 我在调用Webservice communicator类中得到 java.lang.VerifyError.
此错误仅在Android 4.2 OS设备中出现.它在OS和Tabs的所有其他设备上运行良好.
以下是我的日志:
01-09 06:15:10.263: E/AndroidRuntime(785): FATAL EXCEPTION: Thread-78
01-09 06:15:10.263: E/AndroidRuntime(785): java.lang.VerifyError: org/ksoap2/SoapEnvelope
01-09 06:15:10.263: E/AndroidRuntime(785): at com.weg.ecatalogue.servercommunication.WebServiceCommunicator$2.run(WebServiceCommunicator.java:78)
01-09 06:15:10.263: E/AndroidRuntime(785): at java.lang.Thread.run(Thread.java:856)
Run Code Online (Sandbox Code Playgroud)
关于4.2 OS依赖问题,请建议我.
我有这个肥皂响应,但我的代码不是读取GetLatestReadingByMeterNoResult孩子.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<GetLatestReadingByMeterNoResponse xmlns="http://www.multispeak.org/Version_3.0">
<GetLatestReadingByMeterNoResult objectID="112199498" utility="xxxxx">
<meterNo>112199498</meterNo>
<deviceID>112199498</deviceID>
<readingDate>2013-02-27T17:00:00.000Z</readingDate>
<posKWh>8406</posKWh>
<kW>15.508</kW>
<kWDateTime>2013-02-27T17:00:00.000Z</kWDateTime>
</GetLatestReadingByMeterNoResult>
</GetLatestReadingByMeterNoResponse>
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
码:
XmlDocument resultXml = new XmlDocument();
XmlNamespaceManager mgr = new XmlNamespaceManager(resultXml.NameTable);
mgr.AddNamespace("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
mgr.AddNamespace("", "http://www.multispeak.org/Version_3.0");
resultXml.LoadXml(soapResult);
XmlNodeList nodeList = resultXml.SelectNodes("//GetLatestReadingByMeterNoResult", mgr);
Run Code Online (Sandbox Code Playgroud)
nodeList不返回任何节点
我正在尝试构建一个相当基本的WCF SOAP Web服务,作为Windows服务自托管.Windows服务本身在我的机器上启动并运行 - 我无法通过Visual Studio或Web浏览器在本地访问它.
相关的C#代码如下.假设MyDummyService实施合同IDummyService:
public class Program : ServiceBase
{
private ServiceHost host = null;
private readonly Uri baseAddress = new Uri("http://localhost:8000/DummyAPI");
public static readonly ILog log = LogManager.GetLogger(typeof(Program));
/// <summary>
/// The main entry point for the application.
/// </summary>
public static void Main(string[] args)
{
ServiceBase.Run(new Program());
}
public Program()
{
this.ServiceName = "DummyService";
}
protected override void OnStart(string[] args)
{
log.Info("Starting service");
try
{
base.OnStart(args);
host = new ServiceHost(typeof(MyDummyService), baseAddress); …Run Code Online (Sandbox Code Playgroud) soap ×10
c# ×5
wcf ×3
web-services ×3
wsdl ×2
xml ×2
android ×1
cakephp ×1
java ×1
javascript ×1
linq ×1
nusoap ×1
php ×1
request ×1
soa ×1
soapserver ×1
uddi ×1
verifyerror ×1