SAP SOAMANAGER ping 到 Oracle Service Bus Web 服务端点失败

SAP SOAMANAGER ping to Oracle Service Bus webservice endpoint fails

经过一段时间将所有部分放在一起进行 Java 8 模拟 SAP SOAMANAGER Web 服务 Ping(请参阅 SAP 知识数据库 #1947516),我不得不面对,Oracle Service Bus v11 .1.1.7(WebLogic Server v10.3.6.0 上的运行)似乎只支持使用的 HEAD 方法,但仅支持 GET。

注意:由于新手限制,我不得不用 httpX 交换 httpS ;)

下面"Ping.java"代码的结果是

Trying to perform a HTTP 'GET' on 'httpX://pelican.xxx.de:42/aua_xxx?wsdl'

response: code '200' / message 'OK'

Trying to perform a HTTP 'HEAD' on 'httpX://pelican.xxx.de:42/aua_xxx?wsdl'

response: code '500' / message 'Internal Server Error'

import java.lang.System;

import java.io.IOException;

import java.net.URL;
import java.net.HttpURLConnection;

/**
 * to be able to use SSL you have to add the root certificate to the java keystore:
 * keytool.exe -import -noprompt -trustcacerts -alias rootca2015 -file rootca2015.cer -keystore D:\jdk\jre\lib\security\cacerts -storepass changeit
 * 
 * ...and then use THIS java instance when calling the class:
 * D:\jdk\jre\bin\java Ping https://host.de:4242/test user123 pass123
 */

public final class Ping {

    private static void request(final String url, final String user, final String pass, final String protocol)
    {

        System.out.println("\nTrying to perform a HTTP '" + protocol + "' on '" + url + "'");


        HttpURLConnection httpUrlConnection = null;


        try
        {
            httpUrlConnection = (HttpURLConnection) new URL(url).openConnection();
        }
        catch (java.net.MalformedURLException mue)
        {
            System.out.println("\nMalformedURLException: " + mue);
            System.exit(42);
        }
        catch (IOException ioe)
        {
            System.out.println("\nIOException: " + ioe);
            System.exit(42);
        }



        if ( user != null )
        {
            httpUrlConnection.setRequestProperty ("Authorization", "Basic " + java.util.Base64.getEncoder().encodeToString(((new String(user + ":" + pass)).getBytes())));
        }


        try
        {
            httpUrlConnection.setRequestMethod(protocol);
        }
        catch (java.net.ProtocolException pe)
        {
            System.out.println("\nProtocolException: " + pe);
            System.exit(42);
        }


        int responseCode = 0;
        String responseMessage = null;


        try
        {
            responseCode = httpUrlConnection.getResponseCode();
            responseMessage = httpUrlConnection.getResponseMessage();
        }
        catch (java.net.UnknownHostException uhe)
        {
            System.out.println("\nUnknownHostException: " + uhe);
        }
        catch (IOException ioe)
        {
            System.out.println("\nIOException: " + ioe);
            System.exit(42);
        }


        System.out.println("\nresponse: code '" + responseCode + "' / message '" + responseMessage + "'");

    }

    public static void main(final String[] args)
    {

        if ( args.length < 1 || args.length == 2 || args.length > 3 )
        {
            System.out.println("\nUSUAGE: java HeadPing URL [username password], for example java Ping https://host.de:4242/test user123 pass123\n");
        }

        String url=args[0];

        String user=null;
        String pass=null;

        if (args.length == 3 )
        {
            user=args[1];
            pass=args[2];
        }

        System.out.println("\nINFO: response code for HTTP_OK is '" + HttpURLConnection.HTTP_OK + "'!\n");

        request(url, user, pass, "GET");
        request(url, user, pass, "HEAD");

        System.exit(42);
    }

}

有人能解决这个问题吗? SAP SOAMANAGER 是否能够使用 GET? HEAD 能力可以添加到 OSB 中吗?

OSB 11G 支持 REST。与 12C 相比,它是原始的,但您可以根据 $inbound/ctx:transport/ctx:request/http:http-method/text() 等进行切换。需要编写 OSB 服务以接受特定的 REST 操作才有意义。

但是,您甚至没有调用 OSB 端点。您正在调用 auto generates a WSDL 服务的 URL。

删除 ?wsdl,您将得到您真正想要的响应。