WSO2 APIM:无法从SOAP后端生成REST API

时间:2019-12-27 10:05:11

标签: soap wso2 wso2-am

WSO2 API管理器版本:2.6.0

此链接建议可以从SOAP端点生成REST API: https://docs.wso2.com/display/AM260/Generate+REST+APIs+from+SOAP+Backends

但是,当我选择 Generate REST APIs (生成REST API)选项时,WSO2 APIM不会在 Design API 部分的 API定义下生成操作。 wso2文档, 相反,该API部分显示带有 Test URI 按钮

的WSDL URL

单击“开始创建”按钮

时,我可以看到INFO日志。

信息-SOAPOperationBindingUtils在WSDL中找不到SOAP操作

请提供有关如何使用SOAP wsdl生成REST API的建议

Design API screenshot

Manage section screenshot

Generate REST APIs

下面是用于生成REST API的WSDL

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://www.r2services.com" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.r2services.com" name="CompanyService">
   <types>
      <xsd:schema>
         <xsd:import namespace="http://www.r2services.com" schemaLocation="http://localhost:8080/r2ws/updateCompany?xsd=1" />
      </xsd:schema>
   </types>
   <message name="updateCompany">
      <part name="parameters" element="tns:updateCompany" />
   </message>
   <message name="updateCompanyResponse">
      <part name="parameters" element="tns:updateCompanyResponse" />
   </message>
   <message name="R2Exception">
      <part name="fault" element="tns:R2Exception" />
   </message>
   <message name="Exception">
      <part name="fault" element="tns:Exception" />
   </message>
   <portType name="CompanyService">
      <operation name="updateCompany">
         <input wsam:Action="http://www.r2services.com/updateCompany" message="tns:updateCompany" />
         <output wsam:Action="http://www.r2services.com/CompanyService/updateCompanyResponse" message="tns:updateCompanyResponse" />`enter code here`
         <fault message="tns:R2Exception" name="R2Exception" wsam:Action="http://www.r2services.com/CompanyService/updateCompany/Fault/R2Exception" />
         <fault message="tns:Exception" name="Exception" wsam:Action="http://www.r2services.com/CompanyService/updateCompany/Fault/Exception" />
      </operation>
   </portType>
   <binding name="UpdateCompanyServicePortBinding" type="tns:CompanyService">
      <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
      <operation name="updateCompany">
         <soap12:operation soapAction="http://www.r2services.com/updateCompany" />
         <input>
            <soap12:body use="literal" />
         </input>
         <output>
            <soap12:body use="literal" />
         </output>
         <fault name="R2Exception">
            <soap12:fault name="R2Exception" use="literal" />
         </fault>
         <fault name="Exception">
            <soap12:fault name="Exception" use="literal" />
         </fault>
      </operation>
   </binding>
   <service name="CompanyService">
      <port name="UpdateCompanyServicePort" binding="tns:UpdateCompanyServicePortBinding">
         <soap12:address location="http://localhost:8080/r2ws/updateCompany" />
      </port>
   </service>
</definitions>

点击开始创建按钮

,我也在错误下方观察

[2019-12-30 11:57:50,011]信息-SOAPOperationBindingUtils在WSDL中找不到SOAP操作 [2019-12-30 11:57:50,115]错误-添加:jag org.mozilla.javascript.EcmaError:TypeError:无法从null中读取属性“ length”(/发布商/ site / blocks / item-design / ajax / add .jag#227)         在org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3687)         在org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3665)         在org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3693)         在org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3712)         在org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3725)         在org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1483)         在org.jaggeryjs.rhino.publisher.site.blocks.item_design.ajax.c0._c_anonymous_5(/publisher/site/blocks/item-design/ajax/add.jag:227)         在org.jaggeryjs.rhino.publisher.site.blocks.item_design.ajax.c0.call(/publisher/site/blocks/item-design/ajax/add.jag)         在org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)         在org.jaggeryjs.rhino.publisher.site.blocks.item_design.ajax.c0._c_script_0(/publisher/site/blocks/item-design/ajax/add.jag:54)         在org.jaggeryjs.rhino.publisher.site.blocks.item_design.ajax.c0.call(/publisher/site/blocks/item-design/ajax/add.jag)         在org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)         在org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3091)         在org.jaggeryjs.rhino.publisher.site.blocks.item_design.ajax.c0.call(/publisher/site/blocks/item-design/ajax/add.jag)         在org.jaggeryjs.rhino.publisher.site.blocks.item_design.ajax.c0.exec(/publisher/site/blocks/item-design/ajax/add.jag)         在org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:567)         在org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:273)         在org.jaggeryjs.jaggery.core.manager.WebAppManager.exec(WebAppManager.java:588)         在org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:508)         在org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)         在javax.servlet.http.HttpServlet.service(HttpServlet.java:650)         在javax.servlet.http.HttpServlet.service(HttpServlet.java:731)         在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)         在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)         在org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:743)         在org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)         在org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:377)         在org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)         在org.jaggeryjs.jaggery.core.JaggeryFilter.doFilter(JaggeryFilter.java:21)         在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)         在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)         在org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter.doFilter(ContentTypeBasedCachePreventionFilter.java:53)         在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)         在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)         在org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:124)         在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)         在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)         在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)         在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)         在org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:498)         在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)         在org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)         在org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:80)         在org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:91)         在org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:65)         在org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)         在org.wso2.carbon.tomcat.ext.valves.CarbonTomcatValve $ 1.invoke(CarbonTomcatValve.java:47)         在org.wso2.carbon.webapp.mgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:57)         在org.wso2.carbon.event.receiver.core.internal.tenantmgt.TenantLazyLoaderValve.invoke(TenantLazyLoaderValve.java:48)         在org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:47)         在org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)         在org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:159)         在org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:962)         在org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)         在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)         在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)         在org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)         在org.apache.coyote.AbstractProtocol $ AbstractConnectionHandler.process(AbstractProtocol.java:637)         在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1775)         在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.run(NioEndpoint.java:1734)         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)         在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)         在org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)         在java.lang.Thread.run(Thread.java:748)

1 个答案:

答案 0 :(得分:1)

如果您选择了Pass Through选项,则可能会发生这种情况。确保选择了Generate REST APIs选项。

enter image description here