尝试创建一个C#客户端(将作为Windows服务开发),将SOAP请求发送到Web服务(并获取结果).
从这个问题我看到了这段代码:
protected virtual WebRequest CreateRequest(ISoapMessage soapMessage)
{
var wr = WebRequest.Create(soapMessage.Uri);
wr.ContentType = "text/xml;charset=utf-8";
wr.ContentLength = soapMessage.ContentXml.Length;
wr.Headers.Add("SOAPAction", soapMessage.SoapAction);
wr.Credentials = soapMessage.Credentials;
wr.Method = "POST";
wr.GetRequestStream().Write(Encoding.UTF8.GetBytes(soapMessage.ContentXml), 0, soapMessage.ContentXml.Length);
return wr;
}
public interface ISoapMessage
{
string Uri { get; }
string ContentXml { get; }
string SoapAction { get; }
ICredentials Credentials { get; }
}
Run Code Online (Sandbox Code Playgroud)
看起来不错,任何人都知道如何使用它,如果这是最好的做法?
我正在尝试在我的Ubuntu 16.04服务器中部署一个ReactJS应用程序,但是当我执行命令时:
serve -s build
这是我的package.json文件:
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"bootstrap": "^4.3.1",
"history": "^4.9.0",
"jquery": "^3.4.0",
"moment": "^2.24.0",
"popper.js": "^1.15.0",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-router-dom": "^5.0.0",
"react-scripts": "2.1.8"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
ERROR: Cannot copy to clipboard: …Run Code Online (Sandbox Code Playgroud) 我正在使用 ReactJS 和名为 MaterialUI 的组件库。我的排版组件有问题。
发生的情况是,如果我写了一个长文本,它超出了它的容器并且不会换行:
import React from "react";
import { Redirect } from "react-router";
import { withRouter } from "react-router-dom";
import Container from "@material-ui/core/Container";
import CssBaseline from "@material-ui/core/CssBaseline";
import Typography from "@material-ui/core/Typography";
function Homepage() {
return (
<div>
<React.Fragment>
<CssBaseline />
<Container fixed>
<Typography variant="h1" component="h2" align="center">
123 456 789 qwertyuiopasdfghjklzxcvbnm
</Typography>
</Container>
</React.Fragment>
</div>
);
}
export default withRouter(Homepage);
Run Code Online (Sandbox Code Playgroud)
在图像下方:
这发生在移动模式和桌面模式中。
你知道如何解决这种行为吗?如果已达到容器的最大宽度,我希望长词将在新行上拆分。
我试图找出PM2默认将日志文件保存在哪里?
我正在使用Linux Ubuntu 16.04服务器,并使用进行了全局安装npm i pm2 -g。
我正在引导程序中构建一个 NavBar(使用 React)。我想在按钮的右上角放一个徽章。
这是目前的情况:
<div>
<button className="btn btn-primary btn-lg navbar-btn">
<i class="fas fa-file-invoice-dollar fa-lg"></i>
<span class="badge badge-success">1</span>
</button>
<button className="btn btn-primary btn-lg navbar-btn">
<i class="fas fa-envelope fa-lg"></i>
</button>
<button className="btn btn-primary btn-lg navbar-btn">
<i class="fas fa-cogs fa-lg"></i>
</button>
<button className="btn btn-outline-danger btn-lg" onClick={this.logoutClicked}>
<i class="fas fa-sign-out-alt fa-lg"></i>
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
我想要这样的东西:
我正在尝试使用 NTLM 身份验证进行 SOAP Web 服务调用,但它不起作用。
我使用了 WSDL 服务。
到目前为止我做了什么:
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress address = new EndpointAddress("http://uri.test/");
_client = new TEST_PortClient(binding, address);
if (_client.ClientCredentials != null)
{
_client.ClientCredentials.Windows.AllowNtlm = true; // this method is deprecated
_client.ClientCredentials.Windows.ClientCredential.UserName = "username";
_client.ClientCredentials.Windows.ClientCredential.Password = "password";
}
_client.Open(); // this works successfully
string message = string.Empty;
if (_client.TestConnection(ref message)) // this throw an exception *
{
// do something
}
Run Code Online (Sandbox Code Playgroud)
抛出的异常是:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The …
reactjs ×3
c# ×2
css ×2
javascript ×2
node.js ×2
soap ×2
ubuntu ×2
bootstrap-4 ×1
deployment ×1
html ×1
material-ui ×1
npm ×1
pm2 ×1
wsdl ×1