WebServiceException:方法beaInvoke公开为WebMethod

时间:2018-12-18 05:18:09

标签: java oracle web-services

下面是代码片段。必须在其他服务器中动态调用WSDL 但在致电

(int i = webServiceModuleService.notificationRecieved("xyz");)

返回的异常:(

注意:我的服务中没有任何beaInvoke方法:|

    public static void main(String[] args) {

    java.sql.Connection conn = null;
    InitialContext context;

    try {

        context = new InitialContext();

        DataSource ds = (DataSource) context.lookup("jdbc/dataSourceDS");

        conn = ds.getConnection();
    } catch (SQLException e) {
    } catch (NamingException e) {
    }
    QueryRunner run = new QueryRunner();
    SampleResultSetHandler h = new SampleResultSetHandler();
    Object[] res = null;

    try {
        res = run.query(conn, "select SERVER_IP,SERVER_PORT from SERVER where UPPER(SERVER_NAME)=? ", h, "test");
    } catch (SQLException e) {
    }

    String ip = res[0].toString();
    String port = res[1].toString();

    String endpointURL = "http://" + ip + ":" + port + "/context-root/WebServiceModuleService";

    try {

        URL tmpURL = new URL(endpointURL + "?wsdl");
        System.err.println(tmpURL);

        WebServiceModuleService_Service webServiceModuleService_Service = new WebServiceModuleService_Service(tmpURL,
                                                                                                              new QName("/org/parsisys/test/mina/model/services/common/",
                                                                                                                        "WebServiceModuleService"));
        WebServiceModuleService webServiceModuleService = null;
        webServiceModuleService = webServiceModuleService_Service.getWebServiceModuleServiceSoapHttpPort();

        BindingProvider bp = (BindingProvider) webServiceModuleService;
        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);

        // Configure credential providers
        Map<String, Object> requestContext = ((BindingProvider) webServiceModuleService).getRequestContext();

        try {
            setPortCredentialProviderList(requestContext);
        } catch (Exception ex) {
            ex.printStackTrace();
        }

        //Call WebService ... ==> Exception :(
        int i = webServiceModuleService.notificationRecieved("xyz");

        //logp("successfully call the webservice for [ip&port:" + ip + ":" + port + "] [transid : " +transid + "]");

    } catch (Exception e) {
        //log
        //TODO: Clean This
        System.err.println(e.getMessage());
        e.printStackTrace();
        return;
    }
}

@Generated("Oracle JDeveloper")
public static void setPortCredentialProviderList(Map<String, Object> requestContext) throws Exception {
    // TODO - Provide the required credential values
    String username = "";
    String password = "";
    String clientKeyStore = "";
    String clientKeyStorePassword = "";
    String clientKeyAlias = "";
    String clientKeyPassword = "";
    String serverKeyStore = "";
    String serverKeyStorePassword = "";
    String serverKeyAlias = "";
    List<CredentialProvider> credList = new ArrayList<CredentialProvider>();

    // Add the necessary credential providers to the list

    // Code commented out due to empty username/password value found in the credential.
    // credList.add(getUNTCredentialProvider(username, password));

    // Code commented out due to empty server keystore value found in the credential.
    // credList.add(getBSTCredentialProvider(clientKeyStore, clientKeyStorePassword, clientKeyAlias, clientKeyPassword, serverKeyStore, serverKeyStorePassword, serverKeyAlias, requestContext));

    credList.add(getSAMLTrustCredentialProvider());

    requestContext.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credList);
}

@Generated("Oracle JDeveloper")
public static CredentialProvider getSAMLTrustCredentialProvider() {
    return new SAMLTrustCredentialProvider();
}

daynamic Webservice调用是用jdeveloper生成的,它可以在clien't tester中工作,但是在我的模块中,当我调用webservice返回异常时:

StackTrace是:↓

  

方法beaInvoke作为WebMethod公开,但是在wsdl:portType {/ org / parsisys / test /中没有名称为{/ org / parsisys / test / mina / model / services / common /} beaInvoke的相应wsdl操作。 mina / model / services / common /} WebServiceModuleService   javax.xml.ws.WebServiceException:方法beaInvoke作为WebMethod公开,但是在wsdl:portType {/ org中没有名称为{/ org / parsisys / test / mina / model / services / common /} beaInvoke的相应wsdl操作/ parsisys / test / mina / model / services / common /} WebServiceModuleService       在com.sun.xml.ws.model.JavaMethodImpl.freeze(JavaMethodImpl.java:382)       在com.sun.xml.ws.model.AbstractSEIModelImpl.freeze(AbstractSEIModelImpl.java:124)       在com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:336)       在com.sun.xml.ws.db.DatabindingImpl。(DatabindingImpl.java:99)       在com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74)       在com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58)       在com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:120)       在com.sun.xml.ws.client.WSServiceDelegate.buildRuntimeModel(WSServiceDelegate.java:882)       在com.sun.xml.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:899)       在com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:862)       在com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:451)       在weblogic.wsee.jaxws.spi.WLSProvider $ ServiceDelegateImpl.internalGetPort(WLSProvider.java:1698)       在weblogic.wsee.jaxws.spi.WLSProvider $ ServiceDelegateImpl $ PortClientInstanceFactory.createClientInstance(WLSProvider.java:1769)       在weblogic.wsee.jaxws.spi.ClientInstancePool.takeSimpleClientInstance(ClientInstancePool.java:389)       在weblogic.wsee.jaxws.spi.ClientInstancePool.take(ClientInstancePool.java:243)       在weblogic.wsee.jaxws.spi.WLSProvider $ ServiceDelegateImpl $ 3.apply(WLSProvider.java:1555)       在weblogic.wsee.jaxws.spi.WLSProvider $ ServiceDelegateImpl $ 3.apply(WLSProvider.java:1517)       在weblogic.wsee.jaxws.spi.ClientIdentityRegistry.initClientIdentityFeatureAndCall(ClientIdentityRegistry.java:1456)       在weblogic.wsee.jaxws.spi.WLSProvider $ ServiceDelegateImpl.getPort(WLSProvider.java:1513)       在com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:420)       在weblogic.wsee.jaxws.spi.WLSProvider $ ServiceDelegateImpl.getPort(WLSProvider.java:1477)       在com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:402)       在javax.xml.ws.Service.getPort(Service.java:119)       在org.parsisys.test.mina.model.service.WebServiceModuleService_Service.beaInvokeSuper(WebServiceModuleService_Service.java)       在org.parsisys.test.mina.model.service.WebServiceModuleService_Service $ beaVersion0_31.getWebServiceModuleServiceSoapHttpPort(WebServiceModuleService_Service.java:51)       在org.parsisys.test.mina.model.service.WebServiceModuleService_Service.getWebServiceModuleServiceSoapHttpPort(WebServiceModuleService_Service.java)       在org.parsisys.test.mina.files.notification.queue.NotificationQueueRecieved $ beaVersion0_11.onMessage(NotificationQueueRecieved.java:330)       在org.parsisys.test.mina.files.notification.queue.NotificationQueueRecieved.onMessage(NotificationQueueRecieved.java)       在weblogic.jms.client.JMSSession.onMessage(JMSSession.java:5107)       在weblogic.jms.client.JMSSession.execute(JMSSession.java:4775)       在weblogic.jms.client.JMSSession.executeMessage(JMSSession.java:4170)       在weblogic.jms.client.JMSSession.access $ 000(JMSSession.java:127)       在weblogic.jms.client.JMSSession $ UseForRunnable.run(JMSSession.java:5627)       在weblogic.work.SelfTuningWorkManagerImpl $ WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:666)       在weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348)       在weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333)       在weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54)       在weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41)       在weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640)       在weblogic.work.ExecuteThread.execute(ExecuteThread.java:406)       在weblogic.work.ExecuteThread.run(ExecuteThread.java:346)

请帮助我。 tnx

1 个答案:

答案 0 :(得分:0)

对我来说,当WSDL与生成的类不一致时,就会发生这种情况。