我正在尝试使用 Node 使用 SOAP WS-Security 服务,并且请求必须具有如下摘要结构:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://ws.hc2.dc.com/v1">
<soapenv:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-F9932E49C67837D88415342820380929"><!--DATA--></wsse:BinarySecurityToken>
<ds:Signature Id="SIG-F9932E49C67837D884153428203810212" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
</ds:Signature>
<wsse:UsernameToken wsu:Id="UsernameToken-F9932E49C67837D88415342820380868">
<wsse:Username><!--DATA--></wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"><!--DATA--></wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"><!--DATA--></wsse:Nonce>
<wsu:Created>2018-08-14T21:27:18.086Z</wsu:Created>
</wsse:UsernameToken>
<wsu:Timestamp wsu:Id="TS-F9932E49C67837D88415342820380867">
<wsu:Created>2018-08-14T21:27:18.086Z</wsu:Created>
<wsu:Expires>2018-08-14T21:28:18.086Z</wsu:Expires>
</wsu:Timestamp>
</wsse:Security>
</soapenv:Header>
<soapenv:Body wsu:Id="id-E40CE4DF6628FFDAE615320042127276" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<!--BODY-->
</soapenv:Body>
</soapenv:Envelope>
Run Code Online (Sandbox Code Playgroud)
请注意,标题仅包含security包含 4 个元素的标签:
BinarySecurityTokenSignatureUsernameTokenTimestamp使用 node soap模块,我只能生成一个标题:
UsernameToken 和 TimestampBinarySecurityToken, Signature, Timestamp(我不确定这些是否正确)但是我无法生成带有 4 个安全元素的标头。
那么,如何在 Node 中使用具有这四个限制的 SOAP WS-Security 服务?或者也许在 PHP 中?
我读过 Java 和 C# …
这是我的用户类:
import 'package:geocoder/model.dart';
import 'package:json_annotation/json_annotation.dart';
import './resource.dart';
part 'user.g.dart';
@JsonSerializable()
class User extends Resource {
User(this.email, this.name);
String email;
String name;
List<Address> addresses;
factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json);
Map<String, dynamic> toJson() => _$UserToJson(this);
}
Run Code Online (Sandbox Code Playgroud)
构造函数返回类型 'Address' 不是预期类型 'UserAddress'.dart(invalid_cast_new_expr)
在命名构造函数 UserAddress.fromJson 中:
import 'package:geocoder/geocoder.dart';
import 'package:json_annotation/json_annotation.dart';
part 'user-address.g.dart';
@JsonSerializable()
class UserAddress extends Address {
UserAddress();
factory UserAddress.fromJson(Map<String, dynamic> …Run Code Online (Sandbox Code Playgroud)