小编Jua*_*les的帖子

使用 Node 或 PHP 使用 SOAP WS-Security

我正在尝试使用 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 个元素的标签:

  • BinarySecurityToken
  • Signature
  • UsernameToken
  • Timestamp

使用 node soap模块,我只能生成一个标题:

  • UsernameTokenTimestamp
  • BinarySecurityToken, Signature, Timestamp(我不确定这些是否正确)

但是我无法生成带有 4 个安全元素的标头。

那么,如何在 Node 中使用具有这四个限制的 SOAP WS-Security 服务?或者也许在 PHP 中?

我读过 Java 和 C# …

php ws-security soap node.js wsse

5
推荐指数
0
解决办法
1476
查看次数

Dart 使用 json_serializable 解析到/从 json 库类

  • 我正在使用地理编码器库颤振中。
  • 当我得到一个地址时,我想将它作为用户(对象)属性保存在firebase
    firestore 中
    ,但要做到这一点,我需要
    序列化地址(将其转换为地图)。
  • 目前,我正在使用 json_serializable来解析/映射我的 User 类。
  • 因为地址是地理编码器库中的一个类,所以我在将其解析为地图或从地图解析它时遇到了麻烦,因为这是由 json_serializable 处理的。

这是我的用户类:

    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)
  • 我尝试创建一个名为 UserAddress 的新类,其父类将是如下地址,但出现错误

构造函数返回类型 '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)

dart flutter

4
推荐指数
1
解决办法
2953
查看次数

标签 统计

dart ×1

flutter ×1

node.js ×1

php ×1

soap ×1

ws-security ×1

wsse ×1