从SOAP请求中删除命名空间 [英] Removing the namespace from SOAP request

查看:673
本文介绍了从SOAP请求中删除命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已导入WSDL并使用它发送SOAP请求。看起来像这样:

I have imported a WSDL and use it to send a SOAP request. It looks like this:

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Body>
        <Calculate xmlns="urn:xx.WSDL.xxxxxWebService">
            <ContractdocumentIn>
                <AL>
                ...More XML...

问题是计算元素中的xmlns =urn:xx.WSDL.xxxxxWebService部分。 Web服务不能接受。网络服务不喜欢这样的命名空间...

使用 SoapUI 我发现这个请求正常工作:

The problem is the xmlns="urn:xx.WSDL.xxxxxWebService" part in the Calculate element. The web service cannot accept this. The web service doesn't like namespaces like this...
Using SoapUI I found this request to work just fine:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:col="http://example.com.service.xxx/">
    <SOAP-ENV:Body>
        <col:Calculate>
            <ContractdocumentIn>
                <AL>
                    ...More XML...

那么,如何更改请求第一到第二版? (不使用肮脏的技巧!)
(重新导入不是问题,如果这将导致适当的请求格式。)

So, how do I change the request from the first to the second version? (Without using dirty tricks!)
(Re-importing is not a problem if this would result in the proper request format.)




再次:没有肮脏的技巧允许,像黑客请求流修改它!

虽然我还没有完全测试,但似乎C#/ VS2010和Delphi 2010也无法使用我想要调用的Web服务。一个似乎用Java编写的Web服务。 SoapUI 恰好是用Java编写的,因此我们有一个Java客户端与Java服务交谈,这似乎工作正好。但任何其他客户端?

无论如何,添加两个标签的时间:Java,因为它是一个Java服务,而vs2010,因为.NET也不喜欢这个服务。
而且我即将在.NET中编写一个包含这个服务的包装,希望能够正常工作...它不会。所以这是一个非常严重的缺陷,可能是Java的缺陷...

And while I haven't completely tested it, it seems that C#/VS2010 and Delphi 2010 are also unable to use the web service that I'm trying to call. A web service that seems to be written in Java. SoapUI happens to be written in Java, thus we have a Java client talking to a Java service, which seems to work just fine. But any other client?
Anyways, time to add two more tags: "Java", since it's a Java service, and "vs2010" because .NET also dislikes this service.
And I was about to write a wrapper around this service in .NET, hoping that would work... It doesn't. So this is a very serious flaw, possibly a Java flaw...

推荐答案

如果一个服务期望:

  <col:Calculate>
     <ContractdocumentIn>
         <AL>

和Delphi SOAP正在发送...

and Delphi SOAP is sending...

    <Calculate xmlns="urn:xx.WSDL.xxxxxWebService">
        <ContractdocumentIn>
            <AL>

...问题是ContractdocumentIn是一个不合格的元素,(直到Delphi XE)Delphi SOAP不支持作为操作的顶级元素的不合格元素。顶级元素是函数的参数,无法存储底层元素必须不合格的事实;对于映射到属性的元素,我们使用属性的索引来存储IS_UNQL标志。

... the problem is that ContractdocumentIn is an unqualified element and (until Delphi XE) Delphi SOAP did not support unqualified elements that are top level elements of an operation. Top level elements are parameters of the function and there is nowhere to store the fact that the underlying element must be unqualified; for elements that map to properties, we use the Index of the property to store away the IS_UNQL flag.

BTW,没有必要使用前缀。该服务将(应该)也接受:

BTW, it's not necessary to use a prefix. The Service will (should) also accept:

    <Calculate xmlns="urn:xx.WSDL.xxxxxWebService">
        <ContractdocumentIn xmlns="">
            <AL>

后者更详细,但它相当于前缀大小写。

The latter is more verbose but it's equivalent to the prefix case.

在Delphi XE中,导入程序存储一个事实,即特定参数映射到不合格的元素,并且运行时对该信息执行操作。最近,我发布了一个基于D2010和D2007的XE实现的修补程序:

In Delphi XE the importer stores away the fact that a particular parameter maps to an unqualified element and the runtime acts on this information. I've posted patches based on the XE implementation for D2010 and D2007 in the newsgroup when it came up in a thread recently:

https://forums.embarcadero.com/thread.jspa?threadID=43057

如果有人需要访问他们(他们在附件区域,但可能已经滚动),请给我发电子邮件,我会让它们可用。 [bbabet at embarcadero dot com]

If someone needs access to them (they were in the attachments area but might have scrolled off), please email me and I'll make them available. [bbabet at embarcadero dot com]

干杯,

Bruneau

这篇关于从SOAP请求中删除命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆