我正在尝试设置全局标头以将特定安全信息发送到后端适配器。这似乎不适用于使用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];
发送的标头根本不会改变。
答案 0 :(得分:1)
您如何检查标头是否已发送? MobileFirst的哪个确切版本?
重现的步骤I
在我的addGlobalHeader
中添加了doInvokeProcedure
行:
- (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
。