Как перенести Axis 1.4 Client на Axis 2 (IBM MQ) - PullRequest
0 голосов
/ 24 февраля 2020

В настоящее время я использую Axis1.4 для использования SOAP Webservice (через IBM MQ). Теперь я хочу перенести существующий клиент на Axis2. Может ли кто-нибудь помочь мне в миграции клиента?

Я использую код ниже -

MainClass

        EngineConfiguration clientConfig = createClientConfig(chReq);
        logger.info("Creating engine");
        AxisClient axisClient = new AxisClient(clientConfig);

        XYZLocator locator = new XYZLocator(clientConfig);
        locator.setEngineConfiguration(clientConfig);
        locator.setEngine(axisClient);

        CustomProfile custProfile = new CustomProfile();
        custProfile.setVendorID("TEST_VENDOR");

        String namespace = "urn://<namespace>";

        SOAPHeaderElement header = new SOAPHeaderElement(namespace, "CustomProfile", custProfile);
        header.setActor(null);

        inqStub = (XYZMessagingSoapInquiryStub) locator.getXYZMessagingSoapInquiry03();
        inqStub.setHeader(header);

        inqStub.getDataFromService();

/**
** Method for EngineConfiguration
**/
private EngineConfiguration createClientConfig(ChannelRequest chReq) throws Exception {
        SimpleProvider clientConfig = new SimpleProvider();
        try {
            SimpleChain reqHandler = new SimpleChain();
            SimpleChain respHandler = new SimpleChain();
            Hashtable<String, Object> opts = new Hashtable();
            opts.put("ChannelRequest", chReq);
            opts.put("PortType", "INQ");

            Handler pivot = new CustomMQSender();
            pivot.setOptions(opts);
            Handler transport = new SimpleTargetedChain(reqHandler, pivot, respHandler);
            clientConfig.deployTransport("http", transport);
        } catch (Exception e) {
            error(chReq, e.getMessage());
            throw e;
        }
        return clientConfig;
    }
...