0

我正在尝试设置全局标头以将特定的安全信息发送到后端适配器。这似乎不适用于使用 Objective-C 的原生 iOS 应用程序。我敢肯定,我错过了一些东西。

这是我的简单示例:

NSLog(@"Invoking Procedure...");
WLProcedureInvocationData *myInvocationData = [[WLProcedureInvocationData alloc] initWithAdapterName:@"RSSReader" procedureName:@"getStories"];
MyInvokeListener *invokeListener = [[MyInvokeListener alloc] initWithController: self];
[[WLClient sharedInstance] addGlobalHeader:@"header1" headerValue:@"header1"];
[[WLClient sharedInstance] invokeProcedure:myInvocationData withDelegate:invokeListener];

发送的标头根本不会改变。

4

1 回答 1

1

您如何检查标头是否已发送?
哪个确切版本的 MobileFirst?

我为重现所做的步骤:

  • 运行 MobileFirst Studio 6.3.0.00.20150130-1638
  • 我已经下载了 ios 示例中的调用 ( https://ibm.biz/BdEw79 )
  • 在我的中添加了您的addGlobalHeaderdoInvokeProcedure

    - (IBAction)doInvokeProcedure:(UIButton *)sender {
    [self updateView:@"Invoking Procedure..."];
    NSLog(@"Invoking Procedure...");
    WLProcedureInvocationData *myInvocationData = [[WLProcedureInvocationData alloc] initWithAdapterName:@"RSSReader" procedureName:@"getStories"];
    MyInvokeListener *invokeListener = [[MyInvokeListener alloc] initWithController: self];
    [[WLClient sharedInstance] addGlobalHeader:@"header1" headerValue:@"header1"];
    [[WLClient sharedInstance] invokeProcedure:myInvocationData withDelegate:invokeListener];
    
    }
    
  • 在 WireShark 中捕获流量:

    POST /InvokingAdapterProceduresNative/apps/services/api/InvokingAdapterProceduresiOS/iOSnative/query HTTP/1.1
    Host: localhost:10080
    X-Requested-With: XMLHttpRequest
    User-Agent: InvokingAdapterProceduresiOS/1.0 (iPhone Simulator; iOS 8.1; Scale/2.00)/WLNativeAPI/6.3.0.00.20150130-1638
    Cookie: WL_PERSISTENT_COOKIE=279ea643-f731-4c5e-8a59-74ed4842b3d8; JSESSIONID=0000x8PNWpTDWKW73FnPaw9oTAm:42599173-098f-4ab1-b562-68c6a8e1f345
    WL-Instance-Id: 7kreem49ql20l2pdf1fuq9q0kc
    x-wl-clientlog-osversion: 8.1
    x-wl-clientlog-env: iOSnative
    header1: header1
    x-wl-clientlog-deviceId: 18A44BA7-4DF9-411B-9577-5954C8E44921
    x-wl-clientlog-model: x86_64
    x-wl-analytics-tracking-id: 6D6B72FD-820C-4EF8-AE45-205723E464FF
    Content-Length: 112
    Connection: keep-alive
    x-wl-clientlog-appname: InvokingAdapterProceduresiOS
    x-wl-platform-version: 6.3.0.00.20150130-1638
    Accept-Language: en
    x-wl-clientlog-appversion: 1.0
    Accept: */*
    Content-Type: application/x-www-form-urlencoded; charset=utf-8
    Accept-Encoding: gzip, deflate
    x-wl-app-version: 1.0
    

注意header1: header1中间的。

于 2015-02-09T14:21:33.587 回答