我有一个 jar 文件,我已经对其进行了反编译,并尝试在 eclipse 中运行它以调试一个问题。 我创建了一个主函数,如下所示
public static void main(String[] args)
{
InterAcctInqServiceProvider inter = new InterAcctInqServiceProvider();
IUsbMessage a = inter.executeOutboundRequest("test");
}
在日食中运行时,我收到错误InterAcctInqServiceProvider 类型中的方法 executeOutboundRequest(IUsbMessage( 不适用于参数 (字符串(
下面是完整的代码。请让我知道如何调用 executeOutboundRequest 方法并在其中传递一个字符串
/* */ import com.ibm.ci.fiusb.app.AbstractOutboundServiceProvider;
/* */ import com.ibm.ci.fiusb.app.UsbMessageFactory;
/* */ import com.ibm.ci.fiusb.common.IUsbMessage;
/* */ import com.ibm.ci.fiusb.common.NVPVO;
public IUsbMessage executeOutboundRequest(IUsbMessage paramIUsbMessage)
/* */ {
/* 48 */ IUsbMessage localIUsbMessage = UsbMessageFactory.createUbusMessage();
/* */ try
/* */ {
/* 51 */ LogManager.logDebug("ServiceProvider:- Enter executeOutboundRequest");
/* 52 */ Object[] arrayOfObject = (Object[])paramIUsbMessage.getPayload();
/* 53 */ NVPVO localNVPVO = (NVPVO)arrayOfObject[1];
/* 54 */ String str1 = (String)localNVPVO.getHashmap().get("endPointUrl");
/* 55 */ String str2 = (String)localNVPVO.getHashmap().get("respTag");
/* 56 */ String str3 = (String)localNVPVO.getHashmap().get("body");
/* 57 */ str3 = "<?xml version="1.0" encoding="UTF-8"?><FIXML xsi:schemaLocation="http://www.bank.com/fixml AcctInq.xsd" xmlns="http://www.bank.com/fixml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">" + str3.trim();
/* 58 */ LogManager.logDebug("ServiceProvider:- RequestXMLMsg" + str3);
/* 59 */ MessageFactory localMessageFactory = MessageFactory.newInstance();
/* 60 */ SOAPMessage localSOAPMessage1 = localMessageFactory.createMessage();
/* */
/* 62 */ SOAPFactory localSOAPFactory = SOAPFactory.newInstance();
/* 63 */ SOAPBody localSOAPBody = localSOAPMessage1.getSOAPBody();
/* 64 */ SOAPElement localSOAPElement1 = localSOAPBody.addChildElement(localSOAPFactory.createName("executeService"));
/* 65 */ SOAPElement localSOAPElement2 = localSOAPElement1.addChildElement(localSOAPFactory.createName("arg_0_0"));
/* 66 */ localSOAPElement2.addTextNode(str3);
/* 67 */ localSOAPMessage1.saveChanges();
/* */
/* 69 */ localSOAPMessage1.writeTo(System.out);
/* */
/* */
/* */ catch (Exception localException)
/* */ {
/* 173 */ // Some code
/* */ }
/* */
/* 183 */ return localIUsbMessage;
/* */ }
/* */
public static void main(String[] args)
{
InterAcctInqServiceProvider inter = new InterAcctInqServiceProvider();
IUsbMessage a = inter.executeOutboundRequest("test");
}
}
String str = "test"
Message msg = Message.obtain();
msg.obj = str;
IUsbMessage a = inter.executeOutboundRequest(msg);
在 Main 方法中添加它,因为您尝试在消息类型中传递字符串。