JAX WS xsd:任何类型都是 XMLSchema 元素

发布于 2024-12-28 03:23:23 字数 596 浏览 2 评论 0原文

处理 xsd:any 类型是 XMLSchema 元素 JAX WS

<types>
<schema targetNamespace="http://www.iona.com/artix/wsdl"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<complexType name="unmappedType">
<sequence>
<xsd:any namespace="##other"
processContents="skip"/>
</sequence>
</complexType>
<element name="request" type="tns:requestType"/>
</schema>
</types>

xml 以 STring 形式存在,如何将其作为文档对象,然后将其内容传输到 SOAPElement 实例

需要实现和客户端代码的指导。

将 XML 字符串转换为元素。并在收到响应后将其读回。

Handling xsd:any type is an XMLSchema element JAX WS

<types>
<schema targetNamespace="http://www.iona.com/artix/wsdl"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<complexType name="unmappedType">
<sequence>
<xsd:any namespace="##other"
processContents="skip"/>
</sequence>
</complexType>
<element name="request" type="tns:requestType"/>
</schema>
</types>

The xml is there as a STring how to have it as a document object, and then transfer its contents into a SOAPElement instance

Need guidance for the implementation and client code.

Convertng the XML String into the Element. and also reading it back once the response is received .

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倒数 2025-01-04 03:23:23

我看到有人否决了您的问题...如果您不介意,我会首先指出您的问题似乎存在的问题:该片段很可能来自 WSDL,但架构相当无效。你应该做的第一件事就是把事情做好。也许是这样的:

<?xml version="1.0" encoding="utf-8"?>
<!--W3C Schema generated by QTAssistant/W3C Schema Refactoring Module (http://www.paschidev.com)-->
<schema targetNamespace="http://www.iona.com/artix/wsdl" xmlns:tns="http://www.iona.com/artix/wsdl" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <complexType name="unmappedType">
        <sequence>
            <any namespace="##other" processContents="skip"/>
        </sequence>
    </complexType>
    <element name="request" type="tns:unmappedType"/>
</schema>

一旦你完成了它,我建议创建一个看起来像你想要的方式的 XML;确保你验证了这一点。将其与您的问题一起发布...

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.iona.com/artix/wsdl">
    <any_element xmlns="otherNS">anyType</any_element>
</request>

然后,当涉及 JAXB 时,我将使用一个免费且易于使用的工具(我推荐 NetBeans ,它有一个简单的界面)。然后编写一个使用您的代码的小型 Java 控制台应用程序;进行调试,看看解组 XML 时会得到什么。也许阅读一点文档,然后最终发帖寻求更具体问题的帮助。

xsd:any 和 JAXB 有很好的文档记录:尝试一下 JAXB.. 。

I see that someone has downvoted your question... If you don't mind, I would first point out the issues your question seems to have: the snippet most likely comes from an WSDL, but the schema is rather invalid. The first thing you should do is to make it right. Maybe something like this:

<?xml version="1.0" encoding="utf-8"?>
<!--W3C Schema generated by QTAssistant/W3C Schema Refactoring Module (http://www.paschidev.com)-->
<schema targetNamespace="http://www.iona.com/artix/wsdl" xmlns:tns="http://www.iona.com/artix/wsdl" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    <complexType name="unmappedType">
        <sequence>
            <any namespace="##other" processContents="skip"/>
        </sequence>
    </complexType>
    <element name="request" type="tns:unmappedType"/>
</schema>

Once you've done it, I suggest making up an XML that looks the way you want; make sure you validate that. Post it along with your question...

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!-- Sample XML generated by QTAssistant (http://www.paschidev.com) -->
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://www.iona.com/artix/wsdl">
    <any_element xmlns="otherNS">anyType</any_element>
</request>

I would then use a tool that's free and easy to use when it comes to JAXB (I recommend NetBeans, it has a straightforward interface). Then write a small Java console app that uses your code; debug through, and see what you get when you unmarshall the XML. Maybe read a little bit the documentation, and then eventually post to ask for help with a more specific question.

The xsd:any and JAXB is pretty well documented: try this about JAXB...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文