平凡的华仔 2017-03-08 09:11 采纳率: 100%
浏览 2347
已采纳

在oracle 11g 中使用utl_dbws包调用webservice报错,跪求大神帮忙!

webservice的wsdl文件内容如下


<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://e3.org/projectws/soapws" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://e3.org/projectws/soapws">
<wsdl:documentation>projectws</wsdl:documentation>
<wsdl:types>
<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://e3.org/projectws/soapws">
<xs:element name="login">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="loginName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="password" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="loginResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="unimethod">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="sessionId" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="funccode" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="args" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="unimethodResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="unimethodRequest">
<wsdl:part name="parameters" element="ns:unimethod"/>
</wsdl:message>
<wsdl:message name="unimethodResponse">
<wsdl:part name="parameters" element="ns:unimethodResponse"/>
</wsdl:message>
<wsdl:message name="loginRequest">
<wsdl:part name="parameters" element="ns:login"/>
</wsdl:message>
<wsdl:message name="loginResponse">
<wsdl:part name="parameters" element="ns:loginResponse"/>
</wsdl:message>
<wsdl:portType name="projectwsPortType">
<wsdl:operation name="unimethod">
<wsdl:input message="ns:unimethodRequest" wsaw:Action="urn:unimethod"/>
<wsdl:output message="ns:unimethodResponse" wsaw:Action="urn:unimethodResponse"/>
</wsdl:operation>
<wsdl:operation name="login">
<wsdl:input message="ns:loginRequest" wsaw:Action="urn:login"/>
<wsdl:output message="ns:loginResponse" wsaw:Action="urn:loginResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="projectwsSoap11Binding" type="ns:projectwsPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="unimethod">
<soap:operation soapAction="urn:unimethod" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="login">
<soap:operation soapAction="urn:login" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="projectwsSoap12Binding" type="ns:projectwsPortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="unimethod">
<soap12:operation soapAction="urn:unimethod" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="login">
<soap12:operation soapAction="urn:login" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="projectwsHttpBinding" type="ns:projectwsPortType">
<http:binding verb="POST"/>
<wsdl:operation name="unimethod">
<http:operation location="unimethod"/>
<wsdl:input>
<mime:content type="application/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="application/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="login">
<http:operation location="login"/>
<wsdl:input>
<mime:content type="application/xml" part="parameters"/>
</wsdl:input>
<wsdl:output>
<mime:content type="application/xml" part="parameters"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="projectws">
<wsdl:port name="projectwsHttpSoap11Endpoint" binding="ns:projectwsSoap11Binding">
<soap:address location="http://192.168.68.32:8080/projectws/services/projectws.projectwsHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="projectwsHttpSoap12Endpoint" binding="ns:projectwsSoap12Binding">
<soap12:address location="http://192.168.68.32:8080/projectws/services/projectws.projectwsHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="projectwsHttpEndpoint" binding="ns:projectwsHttpBinding">
<http:address location="http://192.168.68.32:8080/projectws/services/projectws.projectwsHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

oracle的函数内容如下:

 CREATE OR REPLACE FUNCTION get_session (loginName IN VARCHAR2,
                                        loginPassword IN VARCHAR2)
  RETURN VARCHAR2
AS
  l_service          UTL_DBWS.service;
  l_call             UTL_DBWS.call;

  l_wsdl_url         VARCHAR2(32767);
  l_namespace        VARCHAR2(32767);
  l_service_qname    UTL_DBWS.qname;
  l_port_qname       UTL_DBWS.qname;
  l_operation_qname  UTL_DBWS.qname;

  l_xmltype_in       SYS.XMLTYPE;
  l_xmltype_out      SYS.XMLTYPE;
  l_return           VARCHAR2(32767);
  l_loginName        UTL_DBWS.qname;
  l_loginPassword    UTL_DBWS.qname;

BEGIN
  l_wsdl_url        := 'http://192.168.68.32:8080/projectws/services/projectws?wsdl';
  l_namespace       := 'http://e3.org/projectws/soapws';

  l_service_qname   := UTL_DBWS.to_qname(l_namespace, 'projectws');
  l_port_qname      := UTL_DBWS.to_qname(l_namespace, 'projectwsHttpSoap12Endpoint');
  l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'login');

  l_service := UTL_DBWS.create_service (
    wsdl_document_location => HttpUriType(l_wsdl_url),
    service_name           => l_service_qname);

  l_call := UTL_DBWS.create_call (
    service_handle => l_service,
    port_name      => l_port_qname,
    operation_name => l_operation_qname);

  UTL_DBWS.set_property(l_call, 'SOAPACTION_USE',    'TRUE');
  UTL_DBWS.set_property(l_call, 'SOAPACTION_URI',    'login');
  UTL_DBWS.set_property(l_call, 'ENCODINGSTYLE_URI','http://schemas.xmlsoap.org/soap/encoding/');
  UTL_DBWS.set_property(l_call, 'OPERATION_STYLE', 'document');

  l_loginName := UTL_DBWS.to_qname(l_namespace, loginName);
  l_loginPassword := UTL_DBWS.to_qname(l_namespace, loginPassword);

  UTL_DBWS.add_parameter(l_call, 'loginName', l_loginName, 'ParameterMode.IN');
  UTL_DBWS.add_parameter(l_call, 'password', l_loginPassword, 'ParameterMode.IN');
  UTL_DBWS.set_return_type(l_call, l_loginName);

  l_xmltype_in := SYS.XMLType('<?xml version="1.0" encoding="utf-8"?>'
                     ||         '<login xmlns="' || l_namespace || '">'
                     ||           '<loginName>wstest</loginName>'
                     ||           '<password>123456</password>'
                     ||         '</login>');
  l_xmltype_out := UTL_DBWS.invoke(l_call,l_xmltype_in);

  UTL_DBWS.release_call (l_call);
  UTL_DBWS.release_service (l_service);

  l_return := l_xmltype_out.getStringVal();
  RETURN l_return;
  --EXCEPTION
  --WHEN OTHERS THEN
  --  return sqlerrm;-- 返回错误信息
END;

执行结果如下,报错:

图片说明

用官网的例子在本地跑是可以调用成功的,调用公司项目的web service接口时报错。网上资料比较少,这个问题已经搞了两三天了,要哭,跪求大神帮忙!感激不尽

  • 写回答

3条回答 默认 最新

  • wenfc 2017-03-08 11:03
    关注

    modify context.xml,add [ useHttpOnly="false"]
    CATALINA_HOME/conf/context.xml

    WEB-INF/web.xml

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大