Spring WS WSDL自动曝光:不遵循xsd导入(Spring WS WSDL automatic exposure : xsd import are not followed)

我正在尝试基于多个xml架构为Spring WS Web服务动态生成WSDL。 我有一个多个xsd文件,所有这些文件都是使用xsd:import元素“连接”的。

Spring WS参考说:

如果要使用包含或导入的多个模式,则需要将Commons XMLSchema放在类路径上。 如果Commons XMLSchema在类路径上,则上述元素将遵循所有XSD导入和包含,并将它们作为单个XSD在WSDL中内联。 这极大地简化了模式的部署,这仍然可以单独编辑它们。

所以我添加了这个maven依赖:

    <dependency>
        <groupId>org.apache.ws.xmlschema</groupId>
        <artifactId>xmlschema-core</artifactId>
        <version>2.2.1</version>
    </dependency>

并以这种方式配置WSDL构建器:

@Bean(name="updateContactService")
public DefaultWsdl11Definition defaultWsdl11Definition() throws Exception {
    DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
    wsdl11Definition.setPortTypeName("updateContactPort");
    wsdl11Definition.setLocationUri("/ws/updateContact");
    wsdl11Definition.setTargetNamespace("http://spring.io/guides/gs-producing-web-service");
    wsdl11Definition.setSchema(updateContactXsd());
    return wsdl11Definition;
}   

@Bean
public XsdSchemaCollection updateContactXsd() throws Exception {
    return new SimpleXsdSchema(new ClassPathResource("xsds/contact/outboundMessage.xsd"));
}

但生成的WSDL只包含一个架构元素(并显示导入错误的位置)。

<xs:import namespace="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" schemaLocation="personService.xsd"/>

有小费吗? Spring WS版本是2.3.1

<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.io/guides/gs-producing-web-service" targetNamespace="http://spring.io/guides/gs-producing-web-service">
  <wsdl:types>
    <xs:schema xmlns="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:ns2="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" xmlns:tns0="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/">
    <xs:import namespace="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" schemaLocation="personService.xsd"/>
    <xs:element name="process" type="tns0:processType"/>
    <xs:complexType name="processType">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="Person" type="ns2:Person"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="processResponse" type="tns0:processResponseType"/>
    <xs:complexType name="processResponseType">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="Person" type="ns2:Person"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="processResponse">
    <wsdl:part element="sch:processResponse" name="processResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="updateContactPort">
    <wsdl:operation name="process">
      <wsdl:output message="tns:processResponse" name="processResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="updateContactPortSoap11" type="tns:updateContactPort">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="process">
      <soap:operation soapAction=""/>
      <wsdl:output name="processResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="updateContactPortService">
    <wsdl:port binding="tns:updateContactPortSoap11" name="updateContactPortSoap11">
      <soap:address location="https://localhost:4440/ws/updateContact"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

I'm trying to dynamically generate WSDL for a Spring WS web service, based on multiple xml schemas. I have a multiple xsd files, all of them are "connected" using xsd:import elements.

Spring WS reference says :

If you want to use multiple schemas, either by includes or imports, you will want to put Commons XMLSchema on the class path. If Commons XMLSchema is on the class path, the above element will follow all XSD imports and includes, and will inline them in the WSDL as a single XSD. This greatly simplifies the deployment of the schemas, which still making it possible to edit them separately.

so I added this maven dependency :

    <dependency>
        <groupId>org.apache.ws.xmlschema</groupId>
        <artifactId>xmlschema-core</artifactId>
        <version>2.2.1</version>
    </dependency>

and configurated the WSDL builder in this way :

@Bean(name="updateContactService")
public DefaultWsdl11Definition defaultWsdl11Definition() throws Exception {
    DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
    wsdl11Definition.setPortTypeName("updateContactPort");
    wsdl11Definition.setLocationUri("/ws/updateContact");
    wsdl11Definition.setTargetNamespace("http://spring.io/guides/gs-producing-web-service");
    wsdl11Definition.setSchema(updateContactXsd());
    return wsdl11Definition;
}   

@Bean
public XsdSchemaCollection updateContactXsd() throws Exception {
    return new SimpleXsdSchema(new ClassPathResource("xsds/contact/outboundMessage.xsd"));
}

but the generated WSDL only contains a single schema element (and showing the import with a wrong location).

<xs:import namespace="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" schemaLocation="personService.xsd"/>

Any tips? Spring WS version is 2.3.1

<?xml version="1.0" encoding="UTF-8" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://spring.io/guides/gs-producing-web-service" targetNamespace="http://spring.io/guides/gs-producing-web-service">
  <wsdl:types>
    <xs:schema xmlns="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:ns2="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" xmlns:tns0="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/apps/crmCommon/content/outboundMessage/types/">
    <xs:import namespace="http://xmlns.oracle.com/apps/cdm/foundation/parties/personService/" schemaLocation="personService.xsd"/>
    <xs:element name="process" type="tns0:processType"/>
    <xs:complexType name="processType">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="Person" type="ns2:Person"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="processResponse" type="tns0:processResponseType"/>
    <xs:complexType name="processResponseType">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="Person" type="ns2:Person"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="processResponse">
    <wsdl:part element="sch:processResponse" name="processResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="updateContactPort">
    <wsdl:operation name="process">
      <wsdl:output message="tns:processResponse" name="processResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="updateContactPortSoap11" type="tns:updateContactPort">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="process">
      <soap:operation soapAction=""/>
      <wsdl:output name="processResponse">
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="updateContactPortService">
    <wsdl:port binding="tns:updateContactPortSoap11" name="updateContactPortSoap11">
      <soap:address location="https://localhost:4440/ws/updateContact"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

原文:https://stackoverflow.com/questions/42112775
2022-02-10 09:02

满意答案

js文件中

app.service('mainService',function ($http,$q) {
    this.login = function (userInfo) {
        var defer = $q.defer();
        $http.post(
            'http://localhost/login.php',
            {user: userInfo},
            {headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}}
        )
        .success(function (response) {
            $scope.names = response.records;
            if(res){
                defer.resolve(response);
            }else{
                defer.reject(response);
            }
        })
        .error(function (err) {
            defer.reject(err);
        })
        return defer.promise
    }

});

PHP的服务器端

header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Access-Control-Allow-Headers, accept");

in the js file

app.service('mainService',function ($http,$q) {
    this.login = function (userInfo) {
        var defer = $q.defer();
        $http.post(
            'http://localhost/login.php',
            {user: userInfo},
            {headers: {'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}}
        )
        .success(function (response) {
            $scope.names = response.records;
            if(res){
                defer.resolve(response);
            }else{
                defer.reject(response);
            }
        })
        .error(function (err) {
            defer.reject(err);
        })
        return defer.promise
    }

});

and on the server side in php

header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Access-Control-Allow-Headers, accept");

相关问答

更多

关于msql和mysql

那才有可能我劝你还是打消这念头吧,一年半载学不了什么的。除非整天呆在家研究。劳动局也是为白领(有钱人)开的!!否责很难学会的。再说了 你家人愿意让你成天呆在家学电脑吗?如果边工作边学的话也不好找合适的工作啊,再说了 现在南方偏僻点的城市能找个“一周不超44小时的工作”几乎不可能。每个单位都不把《劳动法》放在眼里

PHP的MySQL共享数据到MSQL(php mysql share data to msql)

你可以简单地访问mysql数据库 you can simply give access to mysql db

PHP / MSQL:用户注册页面(PHP / MSQL : User Sign Up Page)

你在添加用户功能中犯了一个错误。 两个{已打开但只有一个}已关闭。 这就是为什么signUp是未定义的,因为它现在是adduser函数的一部分。 You have made a mistake in the add user function. Two { are opened but just one } is closed. Thats why the signUp is undefined because it is now a part of the adduser function.

MSQL JOIN:我无法显示类别列表(MSQL JOIN: I cant show a list of categories)

尝试这个 你的桌面设计有误。 规格与汽车之间有另一张表。 比如car_apec_value会有carid,specid,value。 通过加入这三个表,您将得到您想要的结果,例如 $resultjoin = mysqli_query($connecDB,"SELECT 'cars'.'idcar', 'specs'.'spec' FROM cars LEFT JOIN car_apec_value ON cars'.idcar = 'car_apec_value'.'carid' where sp...

phonegap / msql(i)无法建立与数据库的连接(phonegap/msql(i) can't establish connection to database)

除非你用拼写错误填充代码,否则你要混合两个完全独立的mysql库: $con=mysqli_connect($host, $username, $password, $dbnaam);// or die($db_error1); ^---note the presence of an 'i' 在其他脚本中: $result = mysql_query($sql) or die(mysql_error()); ^---note the LACK o...

使用msql fetch填充php数组(Fill php array with msql fetch)

简单的方法,可能不是最好的方式,但取决于场景将是: $index = 1; $arr = array(); while ($row = $stmt2->fetch()) { $arr[ $index ] = $row; $index++; } The simple way, which may not be the best way, but that depends on the scenario would be: $index = 1; $arr = array(); ...

将PHP POST变量更改为msql数据库的日期格式(change PHP POST variable into date format for msql database)

您需要使用strtotime()将数据转换为timestamp 。 date()需要第二个参数是一个timestamp值。 试用 - $dateRequired = date("Y-m-d", strtotime($dateRequired)); m / d / y或dmy格式的日期通过查看各个组件之间的分隔符来消除歧义:如果分隔符是斜线(/),则假定美国m / d / y; 而如果分隔符是破折号( - )或点(。),则假定欧洲的dmy格式。 You need to use strtotime(...

如何使用msql检查两个字段是否具有相同的值?(How to check if two fields have same value using msql?)

在fan_following列中使用FRED并在fan_following BOB fan_followed生成Add Me as Fan按钮。 在fan_following列中有BOB ,在fan_following有BOB ,产生了Remove fan按钮。 通过改变: if ($fan_following == "$user" && $fan_followed=="$username") 至: if ($fan_following == $fan_followed) ^ - « (我相信...

离子2用php msql(ionic 2 with php msql)

在js文件中 app.service('mainService',function ($http,$q) { this.login = function (userInfo) { var defer = $q.defer(); $http.post( 'http://localhost/login.php', {user: userInfo}, {headers: {'Content-T...

使用PHP从MSQL查询创建HTML表,没有重复的行?(use PHP to create an HTML table from a MSQL query, without duplicate rows?)

我可能会这样编码,可能不是唯一的方法,但应该基于我相信你试图实现的目标而工作。 请确保将“order by”添加到您的SQL查询中。 echo "<table cellspacing='40'>"; $query2 = "SELECT mods.mid, ayr, mtitle, credits FROM stud, smod, mods WHERE stud.sid = '".$_POST['stuNo']."' and stud.sid = smod.sid and smod.mid = mo...

相关文章

更多

Spring Project Annotations

转自:http://www.cnblogs.com/liubin0509/p/3663807

使用Solr Data Import的delta-import功能

使用Solr Data Import的delta-import功能 Solr提供了full-im ...

(二)solr data import

solr 的 data import 导入 mysql数据 (1)、编辑 example/solr/c ...

Spring与工厂模式

我相信很多在刚刚使用Spring的同事会考虑一个问题:我们为什么要用Spring,Spring虽然给我 ...

Httpclient整合Spring教程

Httpclient和Spring的整合就是把直接new对象的方式改为spring配置即可 1、首先 ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本