ホーム › Networking.WindowsWebServices › WsOpenServiceProxy
WsOpenServiceProxy
関数サービスプロキシを開きエンドポイントへ接続する。
シグネチャ
// webservices.dll
#include <windows.h>
HRESULT WsOpenServiceProxy(
WS_SERVICE_PROXY* serviceProxy,
const WS_ENDPOINT_ADDRESS* address,
const WS_ASYNC_CONTEXT* asyncContext, // optional
WS_ERROR* error // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| serviceProxy | WS_SERVICE_PROXY* | in |
| address | WS_ENDPOINT_ADDRESS* | in |
| asyncContext | WS_ASYNC_CONTEXT* | inoptional |
| error | WS_ERROR* | inoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// webservices.dll
#include <windows.h>
HRESULT WsOpenServiceProxy(
WS_SERVICE_PROXY* serviceProxy,
const WS_ENDPOINT_ADDRESS* address,
const WS_ASYNC_CONTEXT* asyncContext, // optional
WS_ERROR* error // optional
);[DllImport("webservices.dll", ExactSpelling = true)]
static extern int WsOpenServiceProxy(
ref IntPtr serviceProxy, // WS_SERVICE_PROXY*
IntPtr address, // WS_ENDPOINT_ADDRESS*
IntPtr asyncContext, // WS_ASYNC_CONTEXT* optional
IntPtr error // WS_ERROR* optional
);<DllImport("webservices.dll", ExactSpelling:=True)>
Public Shared Function WsOpenServiceProxy(
ByRef serviceProxy As IntPtr, ' WS_SERVICE_PROXY*
address As IntPtr, ' WS_ENDPOINT_ADDRESS*
asyncContext As IntPtr, ' WS_ASYNC_CONTEXT* optional
[error] As IntPtr ' WS_ERROR* optional
) As Integer
End Function' serviceProxy : WS_SERVICE_PROXY*
' address : WS_ENDPOINT_ADDRESS*
' asyncContext : WS_ASYNC_CONTEXT* optional
' error : WS_ERROR* optional
Declare PtrSafe Function WsOpenServiceProxy Lib "webservices" ( _
ByRef serviceProxy As LongPtr, _
ByVal address As LongPtr, _
ByVal asyncContext As LongPtr, _
ByVal error As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WsOpenServiceProxy = ctypes.windll.webservices.WsOpenServiceProxy
WsOpenServiceProxy.restype = ctypes.c_int
WsOpenServiceProxy.argtypes = [
ctypes.c_void_p, # serviceProxy : WS_SERVICE_PROXY*
ctypes.c_void_p, # address : WS_ENDPOINT_ADDRESS*
ctypes.c_void_p, # asyncContext : WS_ASYNC_CONTEXT* optional
ctypes.c_void_p, # error : WS_ERROR* optional
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('webservices.dll')
WsOpenServiceProxy = Fiddle::Function.new(
lib['WsOpenServiceProxy'],
[
Fiddle::TYPE_VOIDP, # serviceProxy : WS_SERVICE_PROXY*
Fiddle::TYPE_VOIDP, # address : WS_ENDPOINT_ADDRESS*
Fiddle::TYPE_VOIDP, # asyncContext : WS_ASYNC_CONTEXT* optional
Fiddle::TYPE_VOIDP, # error : WS_ERROR* optional
],
Fiddle::TYPE_INT)#[link(name = "webservices")]
extern "system" {
fn WsOpenServiceProxy(
serviceProxy: *mut isize, // WS_SERVICE_PROXY*
address: *const WS_ENDPOINT_ADDRESS, // WS_ENDPOINT_ADDRESS*
asyncContext: *const WS_ASYNC_CONTEXT, // WS_ASYNC_CONTEXT* optional
error: *mut isize // WS_ERROR* optional
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("webservices.dll")]
public static extern int WsOpenServiceProxy(ref IntPtr serviceProxy, IntPtr address, IntPtr asyncContext, IntPtr error);
"@
$api = Add-Type -MemberDefinition $sig -Name 'webservices_WsOpenServiceProxy' -Namespace Win32 -PassThru
# $api::WsOpenServiceProxy(serviceProxy, address, asyncContext, error)#uselib "webservices.dll"
#func global WsOpenServiceProxy "WsOpenServiceProxy" sptr, sptr, sptr, sptr
; WsOpenServiceProxy serviceProxy, varptr(address), varptr(asyncContext), error ; 戻り値は stat
; serviceProxy : WS_SERVICE_PROXY* -> "sptr"
; address : WS_ENDPOINT_ADDRESS* -> "sptr"
; asyncContext : WS_ASYNC_CONTEXT* optional -> "sptr"
; error : WS_ERROR* optional -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "webservices.dll" #cfunc global WsOpenServiceProxy "WsOpenServiceProxy" int, var, var, int ; res = WsOpenServiceProxy(serviceProxy, address, asyncContext, error) ; serviceProxy : WS_SERVICE_PROXY* -> "int" ; address : WS_ENDPOINT_ADDRESS* -> "var" ; asyncContext : WS_ASYNC_CONTEXT* optional -> "var" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "webservices.dll" #cfunc global WsOpenServiceProxy "WsOpenServiceProxy" int, sptr, sptr, int ; res = WsOpenServiceProxy(serviceProxy, varptr(address), varptr(asyncContext), error) ; serviceProxy : WS_SERVICE_PROXY* -> "int" ; address : WS_ENDPOINT_ADDRESS* -> "sptr" ; asyncContext : WS_ASYNC_CONTEXT* optional -> "sptr" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT WsOpenServiceProxy(WS_SERVICE_PROXY* serviceProxy, WS_ENDPOINT_ADDRESS* address, WS_ASYNC_CONTEXT* asyncContext, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsOpenServiceProxy "WsOpenServiceProxy" int, var, var, int ; res = WsOpenServiceProxy(serviceProxy, address, asyncContext, error) ; serviceProxy : WS_SERVICE_PROXY* -> "int" ; address : WS_ENDPOINT_ADDRESS* -> "var" ; asyncContext : WS_ASYNC_CONTEXT* optional -> "var" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT WsOpenServiceProxy(WS_SERVICE_PROXY* serviceProxy, WS_ENDPOINT_ADDRESS* address, WS_ASYNC_CONTEXT* asyncContext, WS_ERROR* error) #uselib "webservices.dll" #cfunc global WsOpenServiceProxy "WsOpenServiceProxy" int, intptr, intptr, int ; res = WsOpenServiceProxy(serviceProxy, varptr(address), varptr(asyncContext), error) ; serviceProxy : WS_SERVICE_PROXY* -> "int" ; address : WS_ENDPOINT_ADDRESS* -> "intptr" ; asyncContext : WS_ASYNC_CONTEXT* optional -> "intptr" ; error : WS_ERROR* optional -> "int" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
webservices = windows.NewLazySystemDLL("webservices.dll")
procWsOpenServiceProxy = webservices.NewProc("WsOpenServiceProxy")
)
// serviceProxy (WS_SERVICE_PROXY*), address (WS_ENDPOINT_ADDRESS*), asyncContext (WS_ASYNC_CONTEXT* optional), error (WS_ERROR* optional)
r1, _, err := procWsOpenServiceProxy.Call(
uintptr(serviceProxy),
uintptr(address),
uintptr(asyncContext),
uintptr(error),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WsOpenServiceProxy(
serviceProxy: Pointer; // WS_SERVICE_PROXY*
address: Pointer; // WS_ENDPOINT_ADDRESS*
asyncContext: Pointer; // WS_ASYNC_CONTEXT* optional
error: Pointer // WS_ERROR* optional
): Integer; stdcall;
external 'webservices.dll' name 'WsOpenServiceProxy';result := DllCall("webservices\WsOpenServiceProxy"
, "Ptr", serviceProxy ; WS_SERVICE_PROXY*
, "Ptr", address ; WS_ENDPOINT_ADDRESS*
, "Ptr", asyncContext ; WS_ASYNC_CONTEXT* optional
, "Ptr", error ; WS_ERROR* optional
, "Int") ; return: HRESULT●WsOpenServiceProxy(serviceProxy, address, asyncContext, error) = DLL("webservices.dll", "int WsOpenServiceProxy(void*, void*, void*, void*)")
# 呼び出し: WsOpenServiceProxy(serviceProxy, address, asyncContext, error)
# serviceProxy : WS_SERVICE_PROXY* -> "void*"
# address : WS_ENDPOINT_ADDRESS* -> "void*"
# asyncContext : WS_ASYNC_CONTEXT* optional -> "void*"
# error : WS_ERROR* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。